How to get value of selected radio button using JavaScript ? (original) (raw)

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.

html `

How to get value of selected radio button using JavaScript ?

Select a radio button and click on Submit.

Gender: Male Female Others
Submit