Reputation: 1036
My JQuery function looks like, where a$RadioBtn is the one only radio button list on my form:
IR.Web.cRptCtl.prototype.getSelectedRadioValue = function(a$RadioBtn){
//Here I want to return a$RadioBtn's selected value
}
How do I determine the selected value?
Upvotes: 0
Views: 446
Reputation: 349252
If a$RadioBtn
is a JQuery object of the radio elements, use:
a$RadioBtn.filter(":checked");
This will return a JQuery object, representing the selected radio input field. If you want to perform DOM operations on it, use the .get(0)
method to get the DOM element.
Example:
IR.Web.cRptCtl.prototype.getSelectedRadioValue = function(a$RadioBtn){
var selected = a$RadioBtn.filter(":checked");
alert(selected.val());
}
Upvotes: 1
Reputation: 13756
$('input[name="your_radio_name"]).is('checked').val();
this will return value of your selected radio button
Upvotes: 1