Thursday, November 21, 2013

Show selected div on radiobutton list selection using Jquery

<label><input id="rdb1" type="radio" name="toggler" value="1" />Money</label>
<label><input id="rdb2" type="radio" name="toggler" value="2" />Interest</label>

<div id="blk-1" class="toHide" style="display:none">
    First Div
</div>
<div id="blk-2" class="toHide" style="display:none">
    Second Div
</div>

$(function() {
    $("[name=toggler]").click(function(){
            $('.toHide').hide();
            $("#blk-"+$(this).val()).show('slow');
    });
 });

No comments:

Post a Comment