Something like this: $(button).click(function(){ var total = 0; $(input:radio).each(function(){ total += $(this).val(); }); alert(total); return false; });
On Mon, Jul 27, 2009 at 16:41, briggs81 <brigg...@gmail.com> wrote: > > This is probably simple, but I am new to jQuery and am trying to wrap > my head around things. > > Basically what I am trying to do is a very basic quiz. I have 3 groups > of radio buttons (3 questions with 4 possible answers for each > question, so.. multiple choice). > > Each answer has a number value assigned to it, i.e. value="2". This > would be 2 points. > > After pressing a button I need to be able to select all the radio > buttons have that been checked, and then add all their point values up > and give the user a score. > > Any hints would be appreciated. >