VOOZH about

URL: https://www.geeksforgeeks.org/javascript/how-to-get-value-of-selected-radio-button-using-javascript/

⇱ How to get value of selected radio button using JavaScript ? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to get value of selected radio button using JavaScript ?

Last Updated : 11 Jul, 2025

To get the value of the selected radio button, a user-defined function can be created that gets all the radio buttons with the name attribute and finds the radio button selected using the checked property. The checked property returns True if the radio button is selected and False otherwise. If there are multiple Radio buttons on a webpage, first, all the input tags are fetched and then the values of all the tags that have typed as 'radio' and are selected are displayed.

Example 1: The following program displays the value of the selected radio button when the user clicks on Submit button. 

Output :

👁 How to get value of selected radio button using JavaScript?
How to get the value of the selected radio button using JavaScript?

Example 2: The following program displays the values of all the selected radio buttons when submit is clicked. 

Output: 

👁 How to get value of selected radio button using JavaScript?
How to get the value of the selected radio button using JavaScript?

JavaScript is best known for web page development but is also used in various non-browser environments. You can learn JavaScript from the ground up by following this JavaScript Tutorial and JavaScript Examples.

Comment