Hi,
Got an array of id's, and just want to go over all checkboxes and check those whose id are in the array.
However seems no syntax I'm using will check the checkboxes...
Code:
......
if (currentSelection != '') {
    $('[name=selectedProviders]:checkbox').each(function () {
        alert($(this).attr("id"));              // fine, get correct id!
        alert($(this).attr("name"));            // fine, get correct name (selectedProviders)
        alert($(this).attr("type"));            // fine, get "checkbox"!!!
        $(this).prop("checked", true);          // dang, not checking (at least not visually)
                        
        var id = $(this).attr("id");
        if (jQuery.inArray(id, currentSelection)) {
            // check the checkbox...
        }
        ........
The checkbox being rendered (asp.net mvc) in a table. here's one row to show what that look like:
Code:
<tr class="even">
	<td class="  sorting_1">
		<input type="checkbox" name="selectedProviders" value="ACME Security" id="14">
	</td>
	<td class=" ">ACME Security</td>
	<td class=" ">Security</td>
</tr>
2 bloody hours on this simple issue. Anyone?

Tried every syntax I know:

Code:
$(this).prop("checked", true);          // dang, not checking (at least not visually
//$(this).attr('checked', true);
//$(this).get(0).checked = true;
//$(this)[0].checked = true;