The following code is able to generate the Select drop down list but it is not being populated with options. I am trying to create a 'day of the month' calendar. I am not sure where my code is wrong...
var select_day = document.createElement('select');
select_day.setAttribute('id', 'select_day');
var dayArray = []; // populate day array
for(var i=0; i <= 30; i++){
dayArray[i] = i + 1;
}
console.log(dayArray);
// DATE - create and append options
for(var i=0; i< dayArray.length; i++){
var option = document.createElement('option');
option.setAttribute('value', dayArray[i]);
option.setAttribute('text', dayArray[i]);
select_day.appendChild(option);
}