Shilpa
5 Mar 2022
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?
Rakshit
6 Mar 2022
Best Answer
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.
© 2024 Copyrights reserved for web-brackets.com