I have an javascript array filled with values of checkboxes in a html file. How can i find the specific element and change checksign from jquery.
jQuery.each(substr, function() {
var n = this;
$('input[type=checkbox]').each(function () {
$('input[name='+n+']').attr('checked', true);
});
});
Substr is the array filled with names.
substr = {‘a’, ‘b’, ‘c’, ‘d’}
.The above code does not work. please help
I think
substr = {'a', 'b', 'c', 'd'}should besubstr = ['a', 'b', 'c', 'd'].