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?
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?
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
31 May, 2023
Like Article
Save Article