To check which radio button is selected in a form, we first get the desired input group with the type of input as an option and then the value of this selection can then be accessed by the val() method. This returns the name of the option that is currently selected.
The selector ‘input[name=option]:checked’ is used to select all input groups that have the option type of input in the specified form.
This is shown in the example below.
Check after clicking on the first option:
Check after clicking on the second option:
- How to create a radio button similar to toggle button using Bootstrap ?
- How to set radio button checked by button click in AngularJS ?
- How to check a radio button with jQuery?
- How to change selected value of a drop-down list using jQuery?
- How to get selected text from a drop-down list using jQuery?
- How to get all selected checkboxes in an array using jQuery ?
- How to get file input by selected file name without path using jQuery ?
- How to reset selected value to default using jQuery ?
- How to show contents of selected row of a table in Bootstrap model using jQuery ?
- How to Create Custom Radio Button using HTML and CSS ?
- How to get the value of radio button using AngularJS ?
- jQuery | :selected Selector
- Radio Button Vs Checkbox in HTML
- How to know which php.ini file is used ?
- jQuery | :radio Selector
- button tag vs input type="button" attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.