JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<input type="text" id="row" />
<input type="text" id="col" />
<input type="button" id="generator" value="press on me">
<div id="table_container"></div>
</div>
CSS
table td {
border: 1px solid #ddd;
}
JavaScript
$(function(){
$("#generator").click(function(){
val = $("#row").val();
if(!isNaN(val)){
$("#table_container").html("");
$("#table_container").append("<table>");
for (i=0; i<val; i++) {
$("#table_container table").append("<tr id='"+i+"'>");
for (j=0; j<val; j++){
$("#table_container tr#"+i).append("<td>"+i+"-"+j+"</td>");
}
$("#table_container").append("</tr>");
}
$("#table_container").append("</table>");
}
})
})