style.display ='none'對chrome中的選項標簽不起作用,但它在firefox中有效下面是一些演示問題的示例代碼。如果我點擊Firefox中的按鈕,第一個選項消失。如果我點擊chrome中的按鈕,沒有任何反應,或者更確切地說,如果我檢查第一個選項,它確實具有屬性“style ='display:none'”,但html頁面上的選項本身并未隱藏。<form><select><option>1</option><option>2</option><option>3</option></select><input type="button" onclick="document.getElementsByTagName('option')[0].style.display='none'" value="hide option 1"></form>為什么這不適用于chrome?
style.display ='none'對chrome中的選項標簽不起作用
慕村9548890
2019-08-19 17:18:20