Okay, I cannot figure out what I'm doing wrong here...
Take the following jQuery selector...
$('tr[batchid]:has(span.chkselb input:checked) span[id=assetcount]')
This returns 2 elements. Yet if I do the following selector:
$('tr[batchid]:has(span.chkselb input:checked) span#assetcount')
This returns 0 elements. Aren't these two selectors for all intents and purposes identical?
Or is there some strange interaction with the ":has" operator or something? I got it working with the first statement, but I'm really curious why the second one (my original selector) doesn't work. Any insights?
$('tr[batchid]:has(span.chkselb input:checked) span[id=assetcount]') shouldn't return two elements, as IDs have to be unique.
This suggests to me that you're re-using IDs, and I guess the first one you use doesn't match tr[batchid]:has(span.chkselb input:checked) so the second selector doesn't return any rows.
You should make the IDs unique.
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