user image

Shilpa
Published in : 2022-03-05

Accessing Radio button values using Jquery

jQuery

I have 3 radio buttons and want to get the value of the selected radio button with jQuery?

If I use below code , it returns me all the values of the radio buttons.

$("form :radio")

form is my tag and :radio indicates the input type.

How do I know the value of the selected radio button?

Comments

Rakshit Date : 2022-03-06

Best answers

34

Best answers

34

You can use following jquery to get value of selected radio button only.

$('input[name=radiobtn]:checked', '#form_id').val()

See live working demo here.

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

[solved] SyntaxError: Unexpected token o in JSON at position 1 jQuery
Publish date: 2022-01-30 | Comments: 2

Tag: jQuery

jQuery Selector is not working .click
Publish date: 2022-02-21 | Comments: 1

Tag: jQuery

jQuery alter the class of a button when I click on it?
Publish date: 2022-02-12 | Comments: 1

Tag: jQuery

How to get the style of element in jQuery? add it to another
Publish date: 2022-01-27 | Comments: 2

Tag: jQuery

[SOLVED] jQuery .click() not working with auto added buttons
Publish date: 2021-06-19 | Comments: 2

Tag: jQuery

How to use !important using jQuery css function?
Publish date: 2022-01-27 | Comments: 2

Tag: jQuery

Display JSON in HTML using jQuery
Publish date: 2022-01-30 | Comments: 2

Tag: jQuery