title: How to display a multiplication table from inputted row and column in jquery?
body: <p>I'm a bit struggling on coding multiplication table using jquery, so i already have the code to display the multiplication table from the inputted row, the multiplication table that i need is to display it from inputting how many rows and columns. </p>
  
  <p>Hoping for y'all could help me, big thanks.</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>$( ".button" ).click(function() {
      var n = document.getElementById( "num" ).value; 
      var arr = [];
      for (i=0; i&lt;n; i++)
          arr[i] = [];
  
      var sub = 1;
      var count = 1;
      i = 0;
      while (count &lt;= n){   
          var loopcount = 1;
          while (loopcount &lt;= n){
              arr[i].push(sub);
              sub += count;
              loopcount++;
          }
          count++;
          sub = count;
          i++;
      }
    
      var $table = $("&lt;table&gt;&lt;/table&gt;");
      var $row;
      arr.forEach(function(subArr){ 
          $row = $("&lt;tr&gt;&lt;/tr&gt;"); 
          subArr.forEach(function(el){ 
              $row.append('&lt;td&gt;' + el + '&lt;/td&gt;');
          });
          $table.append($row);
      });
      $table.appendTo(document.body);
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.wrapper {
  margin: 150px auto;
  max-width: 800px;
  text-align: center;
  font-family: 'Oxygen', sans-serif;
  }
  
  form {
    padding: 4em 4em 2em;
    max-width: 400px;
    margin: 100px auto;
    border-radius: 10px;
  }
  
  td {
      padding: 10px;
      text-align: center;
  }
  
  label {
    display: block;
    font-size: 1.6em;
    margin: 0 0 .5em;
    color: #000;
  }
  
  input[type="text"],
  input[type="button"] {
    display: block;
    background: #f5f5f5;
    border: 1px solid #848484;
    font-size: 1.8em;
    border-radius: 10px;
    margin: 30px auto;
  }
  
  table {
      margin: 0 auto;
      border: 5px solid black;
      border-radius: 10px;
      font-size: 24px;  
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;body&gt;
  &lt;div class="wrapper"&gt;
      &lt;h1&gt;multiplication table&lt;/h1&gt;
      &lt;form&gt;
          &lt;label for="num"&gt;Input number of rows&lt;/label&gt;
          &lt;input type="text" value="" id="num"/&gt;
          &lt;input type="button" value="Submit" class="button"/&gt;
          &lt;p id="answer"&gt;&lt;/p&gt;
          &lt;div id="myDiv"&gt;&lt;/div&gt;
      &lt;/form&gt;
          
  &lt;/div&gt; 
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>