var select = document.getElementById('input-select'); // Append the option elements for ( var i = -20; i <= 40; i++ ){ var option = document.createElement("option"); option.text = i; option.value = i; select.appendChild(option); }