I want to fill a select dynamically with years, starting from the year 2000 to 2050, through a for javascript. But the code still does not work for me.
HTML
<select id="año">
</select>
JAVASCRIPT
select = document.getElementById("año");
option = document.createElement("option");
for(i = 2000; i <= 2050; i++){
option.value = i;
option.text = i;
}
select.appendChild(option);
And at the end I only create a single option with the value of 2050.