Thursday, November 13, 2025
HomeLanguagesJavascriptHow to unchecked a radio button using JavaScript/jQuery?

How to unchecked a radio button using JavaScript/jQuery?

In order to uncheck a radio button, there are a lot of methods available, but we are going to see the most preferred methods. In HTML, we can create radio buttons using the same name attribute, and by setting a unique value for each radio button within the group. Only one radio button within the group can be selected at a time.

Methods for unchecking the radio button:

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. 

html




<!DOCTYPE html>
<html lang="en">
 
<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>
        let el_down = document.getElementById("GFG_DOWN");
 
        function gfg_Run() {
            let radioButton = document.getElementById("radio");
            radioButton.checked = false;
            el_down.innerHTML = "Unchecked";
        }
    </script>
</body>
 
</html>


Output:

How to unchecked a radio button using JavaScript/jQuery?

How to unchecked a radio button using JavaScript/jQuery?

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. 

html




<!DOCTYPE html>
<html lang="en">
 
<body>
    <script src=
    </script>
    <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>
        let el_down = document.getElementById("GFG_DOWN");
 
        function gfg_Run() {
            $("#radio").prop("checked", false);
            el_down.innerHTML = "Unchecked";
        }
    </script>
</body>
</html>


Output:

How to unchecked a radio button using JavaScript/jQuery?

How to unchecked a radio button using JavaScript/jQuery?

RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11916 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11983 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7141 POSTS0 COMMENTS
Thapelo Manthata
6836 POSTS0 COMMENTS
Umr Jansen
6839 POSTS0 COMMENTS