How can i know which radio button is selected using jquery

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: $("form :radio") How do I know which one is selected?
Deepak Sharma
Asked 12-12-2024
194

Answer (1)
Hi here is the code: $('#myForm input').on('change', function() { alert($('input[name=radioName]:checked', '#myForm').val()); }); In this code on selecting radio button, you get alert with selected radio button value.
Deepak Sharma
Asked 02-10-2018
45 Likes
Comments
Write comment

Submit your answer