I am trying to create a html table rows on select change my idea to create row is based on the select changes the number of select option is selected that many number or rows i want to be created in a specific html table with a input text box but that is applicable on button click i have no idea how to create on select change
HTML:
<select id="Number_of_position" onchange="getval(this);"></select>
<table id="Positions_names"></table>
JS:
$(document).ready(function(){
var select = document.getElementById("Number_of_position");
for (var i = 100; i >= 1; i--) {
var option = document.createElement('option');
option.text = option.value = i;
select.add(option, 0);
}
});
function getval(sel) {
alert(sel.value);
}
$("#addRow").click(function () {
$("#Positions_names").append("<tr><td><input type='text'></td></tr>");
});