title: JQuery show and hide multiple textboxes
body: <p>I have two checkboxes that show a textbox when checked. The code below works, although I do not think it is very efficient. I wonder if there is an easy way to combine the 'checked'-code for the checkboxes, in case you have more than two. Notice I did not use the <code>.toggle</code> method. The first reason is because it is not clear if a checkbox is initially checked or not. Secondly, I read the <code>.toggle</code> method is deprecated. But maybe others think I should use it anyway in this case.</p>
  
  <pre><code>jQuery(document).ready(function() {
      //initial check
      show_hide();    
  
      $(".checkbox1").change(function() {
          show_hide();        
      });
      $(".checkbox2").change(function() {
          show_hide();            
      });
  
      function show_hide(){
          if($(".checkbox1").prop('checked') == true) {
              $("#textbox1").show();
          } else {
              $("#textbox1").hide();
          }   
          if($(".checkbox2").prop('checked') == true) {
              $("#textbox2").show();
          } else {
              $("#textbox2").hide();
          }   
      }
  });
  </code></pre>