Skip to content
Related Articles
Get the best out of our app
Open App

Related Articles

How to change radio button state programmatically in jQuery ?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

In this article, we will change the selected option of the radio button using jQuery. To select the value of the radio button we can set the “checked” to set to the desired option. For setting the property, we can use the prop() method in jQuery.


$(selector).prop("checked", true); 

Note: Selector, is the desired radio option element to be selected.

Example: Let us create a radio button group to select a favorite cricket player. We have created a radio option. By default, “Sachin” will be selected. When we click the button, the “Dhoni” option will be selected as given in the program.


<!DOCTYPE html>
    <meta charset="utf-8" />
    <script src=
      <legend>Who is Your Favorite Cricketer?</legend>
      <input type="radio" 
             value="Dhoni" />Dhoni<br />
      <input type="radio" 
             value="Shewag" />Shewag<br />
      <input type="radio" 
             name="favorite" checked 
             value="Sachin" />Sachin<br />
      <br />
      <button id="selectID">Select option</button>
      $("#selectID").on("click", function () {
      function selectRadio() {
        let radioOption = jQuery("input:radio[value=Dhoni]");
        // This will select the radio button
        radioOption.prop("checked", true);


change radio state

My Personal Notes arrow_drop_up
Last Updated : 25 Jul, 2021
Like Article
Save Article
Similar Reads
Related Tutorials