get all selected radio button value jquery

Example1

 var orgprice=$(".fprice").html().substring(1);
function CalcOption()
  {
  var symb=$(".fprice").html().substring(0,1);

   var value=0;
   $("input[type=radio]:checked").each(function() {
       value += parseFloat($(this).attr("id").substring(1).replace(",", ""));
   });
  value=parseFloat(orgprice)+parseFloat(value);
 $(".fprice").html(symb+value.toFixed(2));
  }

Example2

result = "success";
$("#myForm input[type=radio]:checked").each(function() {
  if(this.value == "No" && this.checked == true)
  {
     result = "fail";
     return false;
  }
});
alert(result);  

Example3

$(document).ready(function(){
   $("#myForm input[type=radio]:checked").each(function() {
       var value = $(this).val();
   });
});

Leave a Reply