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?
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.