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