Skip to content Skip to sidebar Skip to footer

Populating Checkboxes Dynamically And Set Their Checked State Dynamically

I have a for loop that generates 7 checkboxes in a row dynamically as follows : @for (int i = 1; k < order.Rows.length; i++) { Row: @i
    @for (int j = 1; j

Solution 1:

If you're working with just one element, you can always just modify the HTMLInputElement's .checked property:

$('.myCheckbox')[0].checked = true;
$('.myCheckbox')[0].checked = false;

The benefit to using the .prop() and .attr() methods instead of this is that they will operate on all matched elements.

Hope this helps...


Post a Comment for "Populating Checkboxes Dynamically And Set Their Checked State Dynamically"