This article describes how JS simply sets the default value of the drop-down selection box. Share it for your reference, as follows:
//By default selection of the record corresponding to the background function setSelectOption(objSelect, targetValue){ if(objSelect){ var options = objSelect.options; if(options){ var len = options.length; for(var i=0;i<len;i++){ if(options[i].value == targetValue){ options[i].defaultSelected = true; options[i].selected = true; return true; } } } else { alert('missing element(s)!'); } } else { alert('missing element(s)!'); } } else { alert('missing element(s)!'); }}For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript Search Algorithm and Skills", "Summary of JavaScript Data Structure and Algorithm and Skills", "Summary of JSON Operation Skills in JavaScript", "Summary of JavaScript Switching Special Effects and Skills", "Summary of JavaScript Animation Special Effects and Skills", "Summary of JavaScript Errors and Debugging Skills" and "Summary of JavaScript Mathematical Operation Usage"
I hope this article will be helpful to everyone's JavaScript programming.