befidled
asked on
jquery to display different content based on radio selection
I have the following radio buttons:
I have a hidden div with a class="options2" that has display:none set. If a user selects option 2, I would like to change it to be changed to display:block.
What is the best way to accomplish this?
I have a hidden div with a class="options2" that has display:none set. If a user selects option 2, I would like to change it to be changed to display:block.
What is the best way to accomplish this?
<div class="input-fields-rfq">
<label>Option 1</label><br />
<div><input class="end_user" type="radio" name="end_user" value="1" style="width:30px;"></div>
</div>
<div class="input-fields-rfq">
<label>Option 2</label><br />
<div><input class="end_user" type="radio" name="end_user" value="2" style="width:30px;"></div>
</div>
<div class="input-fields-rfq">
<label>Option 3</label><br />
<div><input class="end_user" type="radio" name="end_user" value="3" style="width:30px;"></div>
</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect. Thanks for the quick response!
brian
brian
//this is going to hide the previous option and show the new one
$("input[name='end_user']"
$(".options1").hide();
$(".options2").hide();
$(".options3").hide();
var value = $(this).val();
$(".options" + value ).show();
});