title: Jquery Click to hide/show div not working
body: <p>Need to use one single button to toggle the show and hide for div
  my code looks something like this</p>
  
  <pre><code>function showTable(number){
   $('#div_'+number).show('slow');
   $('#button_'+number).html("Hide Table").click(function(){
   hideTable(number);
   return false;
   });
  }
  
  function hideTable(number){
   $('#div_'+number).hide('slow');
   $('#button_'+number).html("Show Table").click(function(){
   showTable(number);
   return false;
   });
  }
  
  &lt;div id="div_1" style="display:none"&gt;&lt;/div&gt;
  &lt;button id="button_1" onClick="javascript:showTable(1)"&gt;Show Table&lt;/button&gt;
  &lt;div id="div_2" style="display:none"&gt;&lt;/div&gt;
  &lt;button id="button_2" onClick="javascript:showTable(2)"&gt;Show Table&lt;/button&gt;
  &lt;div id="div_1" style="display:none"&gt;&lt;/div&gt;
  &lt;button id="button_3" onClick="javascript:showTable(3)"&gt;Show Table&lt;/button&gt;
  </code></pre>
  
  <p>The function is working fine at first. But after i show and hide it once, whenever I tried to show it again, it starts chaining show/hide/show/hide by itself without any clicks. And the more I do it, the longer it does the chaining. It seems it's just a loop that everytime it doubles the amount of looping(like show/hide for 2/4/8/16/32 times ....) the more I do the longer it loops. Anyone have a clue what's going on?</p>
  
  <p>I tried to remove the click part in the hideTable function, the loop stops but still whenever I try to hit showTable, it will show then hide it self automatically like it's auto executing the stuff in the click function without any clicks...</p>
  
  <p>Also is there anyway to use the jquery tagging style to call the function instead of using onclick? i know I can do like</p>
  
  <pre><code>$("#button_1").click(function(){......................});
  $("#button_2").click(function(){......................});
  $("#button_3").click(function(){......................});
  </code></pre>
  
  <p>but is there anyway I can group all of them together into a single function and still able to tell which button is clicked? Because I need a way to track which div to show and hide, and change the the text in corresponding button. Thank you very much in advance. m(_ _)m</p>