Demo
<iframe height='265' scrolling='no' title='Tables' src='//codepen.io/fastfoodcoding/embed/jLwvOr/?height=265&theme-id=light&default-tab=result&embed-version=2' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'>See the Pen <a href='https://codepen.io/fastfoodcoding/pen/jLwvOr/'>Tables</a> by fastfoodcoding (<a href='https://codepen.io/fastfoodcoding'>@fastfoodcoding</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>
Code
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<script>
$(document).ready(function() {
$("#btn").click(function() {
var table = $("#table").val();
console.log("printing table for " + table);
var resultString = "";
for (i = 1; i <= 10; i++) {
resultString = resultString + (table + "*" + i + "=" + table * i + "</br>");
}
$("#result").html(resultString);
});
});
</script>
</head>
<body>
Enter a number : <input type="text" name="number" id="table"><br><br>
<button id="btn"> submit </button>
<br>
<p id="result"></p>
</body>
</html>