title: I want to hide the button in javascript
body: <p>I have a HTML form code is as follows</p>
  
  <pre><code>   &lt;div id="foo" style="display:none;"&gt;
     &lt;input type="text" name="name"&gt;
     &lt;input type="text" name="name1"&gt;
     &lt;input type="text" name="name2"&gt;
     &lt;/div&gt;
     &lt;input type="button" onclick="toggle_visibility('foo');" 
     value="Add more" /&gt;   
  </code></pre>
  
  <p>Upon clicking add more all the above textboxes, but the button is still visible and i want to hide that button</p>
  
  <p>Following is the javascript</p>
  
  <pre><code>function toggle_visibility(id) {
         var e = document.getElementById(id);
         if(e.style.display == 'block')
            e.style.display = 'none';
         else
            e.style.display = 'block';
      }
  </code></pre>