0

I have checked show and hide divs based on radio button click, but my code still doesn't work. Basically the div tag will be hidden unless click the "package_1"

    HTML is like this:
   <table><tr><td>
    <input type="radio" name="cars" id="Package_1"  />
    <input type="radio" name="cars" id="Package_2"/> 
   </td></tr></table>   
    <div class="package_extension"></div>  

   JQuery below:  

    $(".package_extension").hide();
    $("#Package_1").click(function(){
       $(".package_extension").show();
      });
Jonas
  • 121,568
  • 97
  • 310
  • 388
Pluto
  • 313
  • 1
  • 8
  • 19

3 Answers3

1

your jquery should be like this, you've missed the quote and also wrong placement of parenthesis

 $(".package_extension").hide();
 $("#Package_1").click(function(){
     $(".package_extension").show();
 });
Ujjwal Manandhar
  • 2,194
  • 16
  • 20
0

You are missing quotes

$('.package_extension').hide();
 $('#Package_1').click(function(){
 $('.package_extension').show();

 )};

try this.

user1
  • 1,063
  • 1
  • 8
  • 28
0

Please have a look at http://jsfiddle.net/2dJAN/46/

<table><tr><td>
    <input type="radio" name="cars" id="Package_1"  />
    <input type="radio" name="cars" id="Package_2"/> 
   </td></tr></table>   
    <div class="package_extension"> package_extension </div>  

$(".package_extension").hide();
     $("#Package_1").click(function(){
         $(".package_extension").show();
     });
vinothini
  • 2,606
  • 4
  • 27
  • 42