title: Why my Multiplication Table is not showing?
body: <p>I can't figure it out what is wrong with my <code>onsubmit</code> event:
  When I press Submit - nothing is happening. When I put cols and rows directly in function show table it works. Here's a link to codepen <a href="http://codepen.io/Y-Taras/pen/VaaBgy" rel="nofollow noreferrer">http://codepen.io/Y-Taras/pen/VaaBgy</a></p>
  <pre><code> window.onload = function() {
     document.getElementById(&quot;show&quot;).onsubmit = function() {
       var cols = document.getElementById(&quot;cols&quot;).value;
       cols = parseInt(cols);
       var rows = document.getElementById(&quot;rows&quot;).value;
       rows = parseInt(rows);
       showTable(rows, cols);
       console.log(rows, cols);
     };
  
     function showTable(rows, cols) {....
  </code></pre>
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> window.onload = function() {
     document.getElementById("show").onsubmit = function() {
       var cols = document.getElementById("cols").value;
       cols = parseInt(cols);
       var rows = document.getElementById("rows").value;
       rows = parseInt(rows);
       showTable(rows, cols);
       console.log(rows, cols);
     };
  
     function showTable(rows, cols) {
       var elem = "&lt;table&gt;";
       for (var i = 1; i &lt; rows + 1; i++) {
         elem += "&lt;tr&gt;";
         for (var j = 1; j &lt; cols + 1; j++) {
           elem += "&lt;td&gt; " + i * j + "&lt;/td&gt;";
           if (j === cols) {
             elem += "&lt;/tr&gt;";
           }
         }
       }
       elem += "&lt;/table&gt;";
       document.getElementById("table").innerHTML = elem;
     }
   };</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div&gt;
    &lt;h1&gt;javascript&lt;/h1&gt;
    &lt;br&gt;
    &lt;p&gt;Multiplication Table&lt;/p&gt;
    &lt;hr/&gt;
    &lt;form&gt;
      Number of rows:
      &lt;input type="text" id="rows" name="rows"&gt;Number of cols:
      &lt;input type="text" id="cols" name="cols"&gt;
      &lt;input id="show" type="submit" value="Submit"&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  &lt;div id="table"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>