Jquery radio button show and hide divs

Posted by vzhen on Stack Overflow See other posts from Stack Overflow or by vzhen
Published on 2011-11-28T09:40:20Z Indexed on 2011/11/28 9:51 UTC
Read the original article Hit count: 380

Filed under:
|
|
|

My html and jquery code here. The jquery code performs if value ending with 123 a specify div will show. But i got a problem here. After i clicked on value c123 and d123 and switch back to a and b radio buttons. The showed div will not disappear. How to fix this?

<input type="radio" value="a" />
<input type="radio" value="b" />
<input type="radio" value="c123" />
<input type="radio" value="d123" />


$(".localBank").hide();
$("input[value$='123']").click(function() {
 var bank = $(this).val();
        $(".localBank").hide();
        $("#localBank"+bank).show();
    });

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about radio-button