I have a HTML form code is as follows

```
   <div id="foo" style="display:none;">
   <input type="text" name="name">
   <input type="text" name="name1">
   <input type="text" name="name2">
   </div>
   <input type="button" onclick="toggle_visibility('foo');" 
   value="Add more" />   

```

Upon clicking add more all the above textboxes, but the button is still visible and i want to hide that button

Following is the javascript

```
function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }

```