I cannot select a checkbox id="Slot[2014-01-01][1][1]"
with JQuery.
I've tried:
$('#Slot[2014-01-01][1][1]')
$('#Slot\\[2014-01-01\\]\\[1\\]\\[1\\]')
$('#Slot\\[2014\\-01\\-01\\]\\[1\\]\\[1\\]')
$('#Slot\\\\[2014-01-01\\\\]\\\\[1\\\\]\\\\[1\\\\]')
$('#Slot\\\\[2014\\\\-01\\\\-01\\\\]\\\\[1\\\\]\\\\[1\\\\]')
...and all the combinations with Slot
to lowercase slot
.
What's driving me crazy is the fact that the Label for="Slot[2014-01-01][1][1]"
works fine, even if I place it on a far away (HTML-wise) modal and call it with a later AJAX query.
I need this to apply CSS styling, and using $checkbox.is(':checked')
is much more reliable than $label.on('click')
.
Thanks
Select it via the raw id attribute.
$(':checkbox[id="Slot[2014-01-01][1][1]"]')
And if all else fails, this will also work (and is also much quicker) on any element:
$(document.getElementById('Slot[2014-01-01][1][1]'))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.