I am trying to make a script that, when I choose in the dropdown 4, the div is repeated 4 times.
<div>repeat<div>
<script type = "text/javascript">
document.write('<select>')
for (var i = 0; i < 10; i++) {
document.write('<option value=' + i + '>' + i + '</option>');
}
document.write('</select>')
</script>
Now the problem is repeat the number of times that the user choose in dropdown.
Listening to the “onchange” event on the select element will give you the feedback you need to modify the document structure. Fiddle example
HTML
JavaScript