- Mark Chang
- 0°C
- 2 年又 325 天
javascript如何通過其 ID 設置選擇元素的選定選項?
如題,透過javascript來針對某個select的option來做選定。document.getElementById("要用來設置select的ID").selectedIndex=第幾個option;或者
document.getElementById("要用來設置select的ID").options.namedItem("第幾個option").selected=true;或者
document.getElementById("要用來設置select的ID").options[第幾個option].selected=true;以上紀錄~
https://innstory.com/story-javascript如何通過其 ID 設置選擇元素的選定選項?-3144
- 920
- 0
- 0

