I am trying to set the value of a <select> with javascript here is my code
var div = document.createElement("DIV");
var select = document.createElement("SELECT");
var option_mon = document.createElement("OPTION");
option_mon.value = "monday";
var monday = document.createTextNode("Monday");
var option_tue = document.createElement("OPTION");
option_tue.value = "tuesday";
var tuesday = document.createTextNode("Tuesday");
select.value = "tuesday";
option_mon.appendChild(monday);
option_tue.appendChild(tuesday);
select.appendChild(option_mon);
select.appendChild(option_tue);
div.appendChild(select);
But when I run this I dont see Tuesday as selected, Monday is selected as it is just the first value in the <select>, how can I set the value of the <select>