2016-07-22 4 views

答えて

0

あなたがこの(使用してjQueryの非表示と表示)を試すことができます。

あなたはそれを動作させるために、ファイルの最初のjqueryのを含める必要が

HTML:

  <script src="jquery-2.1.4.js" type="text/javascript"></script> 

     <input type="radio" class="radiobutton" name="select" value="yes" /> yes 
     <input type="radio" class="radiobutton" name="select" value="no" />no 
     <input type="text" name="name" id="name" value="" /> 

の作業例https://jsfiddle.net/prohit0/zfjsmn59/22/

SCRIPT:

 <script> 

     $(document).ready(function(e) { 
      $('input[type="radio"]').click(function(){ 

      if($(this).attr("value")=="yes"){ 
       //id is the id of the elemnt to hide 
       $('input[id="name"]').show(); 
      }else { 
      $('input[id="name"]').hide(); 
     } 
     }); 
    }); 
    </script> 

http://www.tutorialrepublic.com/faq/show-hide-divs-based-on-radio-button-selection-in-jquery.php

関連する問題