Reputation: 189
Guys How do I get the value of all radio buttons that are in the same group using name. I have been trying like
$("input[value='"+name+"']").each().val();
but its not working. Kindly help
The value of radio buttons, are class names for pictures that I need to hide. Thank you
Upvotes: 1
Views: 73
Reputation: 3034
Try this code
Here AGroup is a Group name of radio button.
$('input:radio[name=AGroup]').each(function() {
alert (this.value);
});
Refer this Demo
I hop it will help you.
Upvotes: 0
Reputation: 187
Try This Link . It May Help You
$(document).ready(function(){
$("#click").on("click",function(){
$("div input[type=radio]").each(function(radio){
alert($(this).val());
});
});
});
Upvotes: 1
Reputation: 36127
Here pass name as radio button group name.
$('input:radio[name='+name+']').each(function() {
console.log(this.value);
});
Upvotes: 1