I have the folowing inptuts!
<input type="checkbox" value="1" />
<input type="checkbox" value="2" />
<input type="checkbox" value="3" />
<input type="checkbox" value="4" />
<input type="checkbox" value="5" />
After using jQuery I want my result to look like this:
<input type="checkbox" value="1" checked />
<input type="checkbox" value="2" />
<input type="checkbox" value="3" checked />
<input type="checkbox" value="4" />
<input type="checkbox" value="5" checked />
I use following code, but it doesn't work.
$(document).ready(function() {
var str = '1,3,5';
var temp = new Array();
temp = str.split(",");
for (a in temp ) {
//$('.check').valueOf().checked;
$('.check').val(append(temp[a])).checked;
//$('#c').append();
}
});
Thanks in advance!