jquery清空select選項(xiàng) jQuery增加、刪除及修改selectoption的方法?
jQuery增加、刪除及修改selectoption的方法?js如何清除select中的值?idea:獲取select tag元素。選擇“選擇”下的選項(xiàng)。替換選項(xiàng)中的內(nèi)容,或刪除選項(xiàng)。代碼:<sc
jQuery增加、刪除及修改selectoption的方法?
js如何清除select中的值?
idea:獲取select tag元素。選擇“選擇”下的選項(xiàng)。替換選項(xiàng)中的內(nèi)容,或刪除選項(xiàng)。代碼:<script>window.onload=函數(shù)(){var oSel=文檔.getElementById(“sel”)var oOpt=新選項(xiàng)(“123”,“abc”)小孩兒(oopt)//添加一個(gè)OptionSel.removeChild選項(xiàng)(oopt)//刪除選項(xiàng)}</script></head><body><select id=“sel”>< option> 1234</option>&如果您最近刪除了此文件或卸載了應(yīng)用程序,請(qǐng)選擇此選項(xiàng)。