title: How do you create a table in jQuery using html user input?
body: <p>I'm pretty junior, so I'm unsure on if I worded the question properly.</p>
  
  <p>I'm looking to create a textbox in HTML where the user can input the amount of columns and rows for the table.  From there I need to use Javascript/Jquery to create the table when the button is clicked.  </p>
  
  <p>So far I have been able to create the text boxes.  I capture the inputed numbers into variables, and created two for loops.</p>
  
  <p>It doesn't work... :/</p>
  
  <pre><code>&lt;body&gt;
  
          Set Rows:&lt;br&gt;
          &lt;input type="text" id="setRows"&gt;
          &lt;br&gt;
          Set Columns:&lt;br&gt;
          &lt;input type="text" id="setColumns"&gt;
  
      &lt;button type='button' onclick='myForm()'&gt;Create Table&lt;/button&gt;
      &lt;p id = "demo1"&gt;&lt;/p&gt;
      &lt;p id = "demo2"&gt;&lt;/p&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>function myForm()
  {
      var setRows = document.getElementById("setRows").value;
      //document.getElementById("demo1").innerHTML = setRows;
  
      var setColumns = document.getElementById("setColumns").value;
      //document.getElementById("demo2").innerHTML = setColumns;
  
  
  }
  
  $(document).ready(function()
      {
      $("button").click(function()
      {
          $("&lt;table&gt;&lt;/table&gt;").insertAfter("p:last");
  
          for (i = 0; i &lt; setRows; i++)
          {
              $("&lt;tr&gt;&lt;/tr&gt;").appendTo("table");
          }
  
          for (i = 0; i &lt; setColumns; i++)
          {
              $("&lt;td&gt;column&lt;/td&gt;").appendTo("tr");
          }
      });
  
  });
  </code></pre>