Skip to content Skip to sidebar Skip to footer

How To Find A Total Sum Of Radio Button Values Using Jquery/javascript?

I have found following tutorial and applied it to my code How to sum radio button values using either Javascript or jQuery? but it didn't work for me. A user has a choice of a pla

Solution 1:

Your are able to do the following:

$(document).ready(function(){
     $("input[type=radio]").change(function(){
         if ($("input[name=groupnine]:checked").val() && $("input[name=groupeight]:checked").val()){
             p1 = $("input[name=groupnine]:checked").val().substring(1)*1;
             p2 = $("input[name=groupeight]:checked").val().substring(1)*1;
             $("#output").val("$"+(p1+p2));
         }
         else{
             //alert('no')
         }
      // alert($(this).val());
     })
});

Check this DEMO: http://jsfiddle.net/1s4gzbys/15/

Post a Comment for "How To Find A Total Sum Of Radio Button Values Using Jquery/javascript?"