title: How to pass parameter from html to jQuery
body: <p>Is there a way to passing one to many parameters from html to jQuery?</p>
  
  <p>The requirement is when a link on the page is clicked, toggle some text for this link, and hide text for other link(s), so I have the following jQuery:</p>
  
  <pre><code>$(link1).click(function(){
      $(hide1).hide(300, function(){
          $(hide2.hide(300, function(){
              $(toggle1).slideToggle(300);
          });
      });
  });
  </code></pre>
  
  <p>If there's five links on the page, I need to repeat the above code 5 time. 
  Any suggestion on how to cut down on repeated code? 
  I was thinking of the following, but somehow not working.</p>
  
  <pre><code>function hideNShow(toggle1, hide1, hide2, hide3, hide4) {
      if(hide1) {
      $(hide1).hide(300, function(){
          if(hide2) {
          $(hide2).hide(300, function(){
              if(hide2) {
              $(hide2).hide(300, function(){
                  if(hide3) {
                  $(hide3).hide(300, function(){
                      if(hide4) {
                      $(hide4).hide(300, function(){
                          $(toggle1).slideToggle(300);
                      });
                      }
                  });
                  }
              });
              }
          });
          }
      });
      }
      return false;
  };
  </code></pre>
  
  <p>Any help much appreciated.
  Thanks,
  June</p>