Show Div When Radio Checked

Posted by maniootek on Stack Overflow See other posts from Stack Overflow or by maniootek
Published on 2013-11-10T21:19:11Z Indexed on 2013/11/10 21:54 UTC
Read the original article Hit count: 178

Filed under:
|
|
|

I tried to use this code:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>

<style type="text/css">
  div {display: none}
</style>

<script type="text/javascript">
    $('.radio1').click(function () {
        $('.div1').show();
    });
    $('.radio2').click(function () {
        $('.div2').show();
    });
</script>

<label><input type="radio" name="group1" class="radio1"></label>
<label><input type="radio" name="group1" class="radio2"></label>

<div class="div1">Radio1 selected !</div>
<div class="div2">Radio2 selected !</div>

But when I check any radio then notthing happens.

I tried with Fiddle: http://jsfiddle.net/Ac9c4/ and same no results

Any idea?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery