I am having difficulty showing a hidden div when a user selects a radio box.
This is my code:
The Jquery
<script>
$(document).ready(function () {
$(".paypalmethod").click(function() {
$(".paypalinfo").show('slow');
});
</script>
The html
<input name="method" type="radio" value="paypal" class="paypalmethod"/><img src="/images/paymentlogos/PayPal.png" />
<div class="paypalinfo" style="display:none">Paypal the safe and easy way to pay. Paypal accepts all major credit cards.</div>
You’re missing a closing
});in your code, you need to close thedocument.readyand the.click(), like this:Also, to not produce a fade when the element’s already visible, add a
:hiddenselector in like I have above. This makes it only find/fade in the element if it’s currently hidden, and wont re-fade it in when it’s already shown.