removing all option of dropdown box in javascript

后端 未结 7 1819
自闭症患者
自闭症患者 2021-02-01 04:21

How can i dynamically remove all options of a drop down box in javascript?

7条回答
  •  半阙折子戏
    2021-02-01 05:17

    var select = document.getElementById('yourSelectBox');
    
    while (select.firstChild) {
        select.removeChild(select.firstChild);
    }
    

提交回复
热议问题