What this is doing: jQuery('.choix1').click(function(){ jQuery('#quest1').hide(); });
is looping through every element on the page with a class of 'choix1', so you could either change all of the elements you want to loop though classes to choix and then do jQuery('.choix').click(function(){ jQuery(this).parent().hide(); }); Which will loop through them all and then hide them when either yes or no is selected or find some other way of identifying every element that you want to act on. Perhaps use the name field, or if they are the only radio buttons on the page you can do jQuery(':radio') as the selector. On Mar 13, 2:45 pm, macgyver47 <jrl...@wanadoo.fr> wrote: > Hi > I am new to jQuery and learning slowly > Here is the problem > I have 6 questions each of them has 2 buttons ( yes or no radio > buttons) > When user clicks on 1 answer I would like to hide the entire question > I have achieved to do this for 1 question but no success looping > through all 6 questions ! > <div id="quest1> > Question 1 > <input class="choix1" type="radio" name="choix1" > onclick='q1=1'>Yes<br> > <input class="choix1" type="radio" name="choix1" onclick='q1=0'>No<br> > </div> > <div id="quest2> > Question 2 > <input class="choix2" type="radio" name="choix1" > onclick='q1=1'>Yes<br> > <input class="choix2" type="radio" name="choix1" onclick='q1=0'>No<br> > </div> > ........... > jQuery('.choix1').click(function(){ > jQuery('#quest1').hide(); > }); > This works for 1 item but how can I loop through all all of them > Thanks for help > Jean from France