title: How to toggle form visibility dynamically?
body: <p>I have page where user can dynamically create new forms. For every new form button is created. Form is hidden by default. I need to toggle form visibility on that button click. Right now i am using javascript code below and its working</p>
  
  <pre><code> $(document).ready(function(){
          $("#button1").click(function(){
              $("#1").css({"display":"block"});
              $("#2").css({"display":"none"});
              $("#3").css({"display":"none"});
  
          });
          $("#button2").click(function(){
              $("#2").css({"display":"block"});
              $("#1").css({"display":"none"});
              $("#3").css({"display":"none"});
          });
         ...
  </code></pre>
  
  <p>Now when user create form i manually modify javascript but problem is that i have too many forms right now and ill have even more.
  I need solution to bind button for form and toggle its visibility. Any advice is appreciate.
  EDIT
  Code i am actually using:</p>
  
  <pre><code>while ($row = $result9-&gt;fetch_assoc()) 
          {
              echo "&lt;input class='btn btn-default' type='button' id='".$row['o_ime']."'  name='button' value='".$row['o_ime']."'&gt;";
          }
  echo "&lt;form class='form-inline' role='form' name='$i' id='$i' style='display:none' action='naruci.php' method='POST' onsubmit='return validateForm()'&gt;";
  form elements
  echo "&lt;/form&gt;";
  </code></pre>