I have problem regarding on how i will limit my default checked checkbox. for example i have 7 checkboxes. and i want to limit it with 3 default checked checkboxes once the page is load.
this should be the output:
Checkbox1 : true
Checkbox2 : true
Checkbox3 : true
Checkbox4 : false
Checkbox5 : false
Checkbox6 : false
Checkbox7 : false
Here's my sample code:
var mvp = 3;
$(document).ready(function() {
$("input:checkbox").each(function( index ) {
($this).attr("checked",true);
});
});
I'm stock with this, i don't know where i will put my counter (mvp) inside my each function. in this code, all my checkboxes are checked :D.
Sorry for a newbie question, please help me..
Decrement
mvp
after you check each checkbox. When it reaches 0, start unchecking.