can we get the values of the radio buttons , only those which has been checked , cause i have to implement a form in which there are many radio buttons , so how can i get all t
This would loop through all the radio elements in the document that have been checked:
$('input:radio:checked').each(function() {
var value = $(this).val();
// do something with radio or value
});
If you wanted to get the checked value of a particular radio group, you would do:
var value = $('input:radio[name=myradios]:checked').val();
So if your HTML was like this:
<input type='radio' name='myradios' value='1'>
<input type='radio' name='myradios' value='2' checked='checked'>
<input type='radio' name='myradios' value='3'>
value
would be 2