How to unchecked a radio button using JavaScript/jQuery?

In order to uncheck a radio button, there is a lot of methods available, but we are going to see the most preferred methods.

Example 1: This example unchecks the radio button by using Javascript checked property. The JavaScript Radio checked property is used to set or return the checked state of an Input Radio Button. This property is used to reflect the HTML checked attribute.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html> 
<html
    <head
        <title
            JavaScript | uncheck a radio button
        </title
    </head
      
    <body style = "text-align:center;" id = "body"
          
        <h1 style = "color:green;"
            GeeksForGeeks 
        </h1
          
        <input id = "radio" type="radio" name="GFG"
                value="GeeksForGeeks" checked>GFG
                  
        <br><br>
          
        <button onclick = "gfg_Run()"
            uncheck
        </button>
          
        <p id="GFG_DOWN" style="color:green;font-size:20px;"></p>
          
        <script>
            var el_down = document.getElementById("GFG_DOWN");
              
            function gfg_Run() {
                var radioButton = document.getElementById("radio");
                radioButton.checked = false;
                el_down.innerHTML = "Unchecked";
            }
        </script
    </body
</html>                    

chevron_right


Output:

  • Before clicking on the button:
  • After clicking on the button:

Example 2: This example unchecks the radio button by using jQuery prop() method. The prop() method in jQuery which is used to set or return the properties and values for the selected elements.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>  
<html>  
    <head
        <title
            JQuery | Uncheck a radio button
        </title>
          
        <script src=
        </script>
    </head
      
    <body style = "text-align:center;" id = "body">  
          
        <h1 style = "color:green;" >  
            GeeksForGeeks  
        </h1
          
        <input id = "radio" type="radio" name="GFG" 
                value="GeeksForGeeks" checked>GFG
                  
        <br><br>
          
        <button onclick = "gfg_Run()"
            uncheck
        </button>
          
        <p id="GFG_DOWN" style="color:green;font-size:20px;"></p>
          
        <script>
            var el_down = document.getElementById("GFG_DOWN");
              
            function gfg_Run() {
                $("#radio").prop("checked", false);
                el_down.innerHTML = "Unchecked";
            }
        </script
    </body>  
</html>

chevron_right


Output:

  • Before clicking on the button:
  • After clicking on the button:


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.