Reputation: 1151
On load of the page I want to set it to FALSE immediately. How I can do that please? thanks
Upvotes: 1
Views: 9044
Reputation: 18290
Check .prop() and .attr() function and take an idea from these code snippets to implement your functionality.
$(document).ready(function(){
$(".myCheckbox").prop("checked", false); // select by css class
or
$("#myCheckbox").prop("checked", false); // select by checkbox id
});
or
$('.myCheckbox').removeAttr('checked')
If you want to uncheck all checkbox on your page then try this:
$(document).ready(function(){
$("input[type='checkbox']").removeAttr('checked')
})
check these links for more details
Setting "checked" for a checkbox with jQuery?
set checkbox from checkboxlist to uncheck using jquery
Upvotes: 0
Reputation: 9403
Check the answer in Fiddle it will make check box selected randomly
To make it false, u can do
$(document).ready(function(){
$("input[name='checkbxName']").removeAttr("checked");
})
Upvotes: 0
Reputation: 15042
$(document).ready(function () {
$("#myCheckbox").prop("checked", false);
});
Upvotes: 0
Reputation: 1038780
$(function() {
$('#id_of_your_checkbox').removeAttr('checked');
});
Upvotes: 2
Reputation: 8482
You can execute methods when DOM is ready with .ready() and you can change value of a checkbox with .prop() like this;
jQuery(function($) {
$('#id_of_checkbox').prop('checked', false);
})
For this example you have to give an id (id_of_checkbox
) to your checbox.
Upvotes: 1