how to select an option in dropdown using js code example Example: javascript select element in dropdown document.getElementById("stateSelect").selected = true;