Can someone help me create a select list that dynamically increases or decreases the number of text boxes displayed based on the user's selection? For example, if the user selects "2" in the select list, then 2 text boxes should appear; if they choose "3", then 3 should appear. I need the HTML and JavaScript code to make this work.
<!DOCTYPE html>
<html>
<head>
<title>MAIN</title>
</head>
<script>
function onchange_action(){
var e=document.getElementsByName("AuthoringForm")[0];
for(j=1; j<(e.value)+1; j++){
var x = document.getElementById((j).value);
console.log(j);
x.style.display = "none";
}
}
</script>
<body>
<form>
...
I've attempted the above code but it's not functioning as expected. Any help would be appreciated!