I'm seeing an error I can't replicate from a small subset of users. Here's the code:
var selected = $('#mytable input:checked');
if (selected.length == 0) {
$('body').trigger('notice', 'Please select some items first');
return;
}
Even when the user checks several checkboxes, the "notice" triggers. It seems selected.length is zero when it shouldn't be.
[UPDATE] The selector works when it's updated to:
var selected = $('input[class="selection"]:checked');
It seems including the id in the selector breaks things, only on IE.
This code is working for the vast majority of users and we can't replicate the issue, but for users that see the issue it's consistent and happens every time.
It seems to be isolated to IE (although I can't be sure). We're using jQuery 1.3.2 (from google CDN).
Any ideas?
It would be a good idea to paste your surrounding code/event handler(s). For a starting point, I would suggest using the :checkbox
selector in your first line:
$('#mytable input:checkbox:checked')
The manual says:
$(':checkbox')
is equivalent to$('*:checkbox')
, so$('input:checkbox')
should be used instead.
Of course, that might not make any difference whatsoever. :checkbox
is equivalent to $('[type=checkbox]')
, so it might be that IE is choking on the input:checked
part of your selector which is testing all input elements for the checked
state.
I ran into a similar problem where, for the life of me, I could not get IE to recognize a box that had been 'checked' programmatically by another event handler.
resorted to:
$("input[name='iptName'][CHECKED]").size()
Apparently, IE (of the 8 flavored variety) was being sensitive about the case. ':checked', ':CHECKED', and '[checked]' were no-go.
Anyone else run into this?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With