Get all checkboxes within a td

176 views Asked by At

I have some check box with a class defined but some of them are children of td and some of them are children of span and I want to fetch all the checkbox children of td by that class. How can I do this?

$(".cropFieldChoiceCheckbox").prop("checked", true);
3

There are 3 answers

0
Harshit Gupta On BEST ANSWER
$("td > .cropFieldChoiceCheckbox").prop("checked", true);
0
Rory McCrossan On

jQuery selectors follow CSS rules, so you can use td .cropFieldShoiceCheckbox to select the checkboxes within td elements:

$("td .cropFieldChoiceCheckbox").prop("checked", true);
0
Hardik Gajjar On

Use custom data element for this kind of problems Form this tutorial

there something called data in jquery Find Here