Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I uncheck a checkbox?

I have a checkbox that is always checked, but base on user input elsewhere in my form (I have a onChange="functionName" on a select box) I would like to uncheck it.

How do I do that?

like image 835
Jason94 Avatar asked May 12 '11 13:05

Jason94


People also ask

How do you uncheck a check box?

Once the checkbox is selected, we are calling prop() function as prop( "checked", true ) to check the checkbox and prop( "checked", false ) to uncheck the checkbox.

How do I uncheck a checkbox in HTML?

To uncheck the checkbox: $("#checkboxid"). removeAttr("checked");

How do you uncheck a selected checkbox when one checkbox is unchecked?

You can do it like below. Add another click event for checkbox under #checkboxlist , if a checkbox is unchecked then uncheck . selectall .

How do I uncheck a specific checkbox in jQuery?

Answer: Use the jQuery prop() method You can use the jQuery prop() method to check or uncheck a checkbox dynamically such as on click of button or an hyperlink etc. The prop() method require jQuery 1.6 and above.


1 Answers

does it need to be done with jQuery ? what about JavaScript please try this:

Check: document.getElementById("ckBox").checked = true;

UnCheck: document.getElementById("ckBox").checked = false;

like image 92
Arrabi Avatar answered Sep 29 '22 14:09

Arrabi