I have a radio button group
<input type="radio" name="Q1" value="Yes />
<input type="radio" name="Q1" value="No />
I also have 2 divs
<div id="Q4" style="display:none"> Some content</div>
<div id="Q5" style="display:none"> Some content</div>
This is what I would like to do using Jquery
If someone clicks radio button with value Yes - set div id=Q4 to display:block. If someone clicks radio button with value No - set div id=Q4 to display:none and set div id=Q5 display:block
I have been trying and not very successful. I have used alerts in the jQuery to try and understand what I am doing wrong. Can anyone please help
$('input[type="radio"]').click(function(){
var userClick= $('input:radio[name=Q1]:checked').val();
switch(userClick){
case 'Yes':
alert('Number1');
case 'No':
alert('Number2');
}
});
breaks.