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