Reputation: 12437
How can I show a div
upon selecting a radio button?
What is the event for a radio button click?
<head>
<script src="http://code.jquery.com/jquery.js"></script>
<style >
</style>
<script type="text/javascript">
$(".static_class").click(function(){if($(this).val()==="Yes") $("#extra").show("fast"); else $("#extra").hide("fast");});
</script>
</head>
<body>
<input id="r1" type="radio" name="14" value="Yes" class="static_class style1" />
Yes<br />
<input id="r2" type="radio" name="14" value="No" class="static_class style1" /> No<br />
<div id="extra"> <br /><label>If yes, please specify.</label> <input id="email" type="text" class="style" /></div>
</body>
Upvotes: 1
Views: 3112