C3rd
Quirks on jQuery plugin "lc_switch"
Posted: 12 May 2021, 21:57pm - Wednesday
We've been using lc_switch for our new UI revamp and found some quirks. Here they are:
When binding lc_switch
jQuery plugin, do not do these following:
QUIRK 1
WRONG
<label class="ocl-switch-label" for="app_confidential">
<input class="ocl-switch" type="checkbox" id="app_confidential" name="app_confidential" /> Is the project confidential?
</label>
CORRECT
<label class="ocl-switch-label" for="app_confidential">
<input class="ocl-switch" type="checkbox" id="app_confidential_answer" name="app_confidential" /> Is the project confidential?
</label>
EXPLANATION:
You should not name the element
id
andname
the same
QUIRK 2
WRONG
<label class="ocl-switch-label" for="app_confidential_answer">
<input class="ocl-switch" type="checkbox" id="app_confidential_answer" name="app_confidential" /> Is the project confidential?
</label>
CORRECT
<label class="ocl-switch-label" for="app_confidential">
<input class="ocl-switch" type="checkbox" id="app_confidential_answer" name="app_confidential" /> Is the project confidential?
</label>
EXPLANATION:
You should not address
label
tagfor=""
attribute to an element'sid
, instead address to element'sname