I have this function, where I am currently pre-selecting all checkboxes:
function setupModuleSelection(selectedModules, preSelected) {
// TODO: preSelected not used
$('#my-table > tbody > tr > td.module_id > input[type="checkbox"]')
.prop('checked', true);
}
Where preSelected = ['module-001', 'module-003', 'module-027'] (for example):
The table is:
<tr>
...
<td class="module_id"><input type="checkbox" name="module_id" value="module-027"></td>
</tr>
Now I want to activate the checkboxes by filtering on the module_id, as provided by the preSelected array. How can I do this with jQuery?
td.module_idin your jquery selection?