AOA, I need to check checkbox by jquery on values basis. e.g now I want when this page is loaded then this chckbox need to be checked.
Best Regrads, Musaddiq Khan
AOA, I need to check checkbox by jquery on values basis. e.g now I want when this page is loaded then this chckbox need to be checked.
Best Regrads, Musaddiq Khan
You can easily do this using the attr command as shown below.
$(".abc").attr('checked', true);
where abc is the name of the class of the check box like
<input type="checkbox" class="abc">
If you want to check it when the page loads just use
$(document).ready(function() {
$(".abc").attr('checked', true);
});
On page-load, you can use the attribute=value
selector:
var valueToFind = 3; // or whatever you're looking for
$('input:checkbox[value="' + valueToFind + '"]').prop('checked',true);
References: