<div id="table">
<input type="checkbox" class="db2applforce kon" value="15010" title="to be forced">
Neither of these work. It returns always 0 instead of the correct number.
alert($("#table").find(".kon :checkbox").length);
alert($("#table").find(":checkbox").find(".kon").length);
Can I do ‘all in one’ query?
Radek,
In your selector, you should not have a space between .kon and :checkbox. This tries to find a div with the class kon and inside of it a checkbox. Since your checkbox is of the class kon, do the following instead:
This yields the right answer. Also, you should always close your divs, i.e.:
For the sake of completeness and further clarity, if your block of HTML had looked like this:
then your first selector above would have worked, and your second one would have worked if swapped: