Can I simplify this?
Can I simplify this?
I have 5 li's that include radio buttons. If you select "Yes" on any of the 5 radio buttons it slides down a warning and clicking no makes it slide up. Is there a way to simplify this so I don't write the same code over and over changing input id's?
<script type="text/javascript">
//Show/Hide professional Status
$(document).ready(function() {
$(".Pro").hide();
$("#SECYes").click(function() {
if($(this).val()==="Yes")
$("#SECPro").slideDown("fast");
});
$("#SECNo").click(function() {
if($(this).val()=="No")
$("#SECPro").slideUp("fast");
});
return false;
//4 more times for each other set of radio buttons
});
</script>
HTML
<li class="bold">
<label for="SECQualified" class="professional">Are You SEC Registered or Qualified?</label>
<span class="narrow"><input type="radio" name="SECQualified" id="SECYes" value="Yes" />Yes</span>
<span class="narrow"><input type="radio" name="SECQualified" id="SECNo" value="No"/>No</span>
</li>
<!--4 more times for each other set of radio buttons-->
Thanks,