title: How to make a button show a table onclick
body: <p>I am trying to embed a table inside a button to no avail, such that when the button is clicked the table shows and when it is clicked again, the table disappears. Here is a copy of my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function myfunction(){    
    document.getElementById("displaytable").style.display = "none";   
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="button" value="Button1" onclick='myfunction();'&gt;
  &lt;div id="displaytable" style="visibility: hidden"&gt;
    &lt;table id="displaytable" style="display: none; width: 100%" cellpadding="1" cellspacing="0" border="3"&gt;
      &lt;tr align="center"&gt;
        &lt;td class="lbl"&gt;column1&lt;/td&gt;
        &lt;td class="lbl"&gt;column2&lt;/td&gt;
        &lt;td class="lbl"&gt;column3&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td align="center"&gt;1&lt;/td&gt;
        &lt;td align="center"&gt;2&lt;/td&gt;
        &lt;td align="center"&gt;33&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td align="center"&gt;4&lt;/td&gt;
        &lt;td align="center"&gt;5&lt;/td&gt;
        &lt;td align="center"&gt;6&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt; 
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>