Menu
Hi all,
I’m only new to javascript, but what I need to do is dynamically create a select, filling it with the days of the month. I also need the select to default to the current day. This is the code I currently have:
function fillDay(){
days = 0;
for(i = 1; i < 32; i++)
{
document.getElementById(‘currDay’).options[i] = new Option(days+i);
}
Then I call that function. Currently it fills a select with all the days of the month (eg 1, 2, 3 etc) and works perfectly. However, I have spent ages trying to figure out how to set the ‘selected’ attribute of the select to be the current day. Any idea on how to do that?
Thanks!