Skip to content
Advertisement

How can I know which radio button is selected via jQuery?

I have two radio buttons and want to post the value of the selected one. How can I get the value with jQuery?

I can get all of them like this:

JavaScript

How do I know which one is selected?

Advertisement

Answer

To get the value of the selected radioName item of a form with id myForm:

JavaScript

Here’s an example:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement