[討論] removeAttr, selected, IE bug?
IE似乎沒辦法消滅selected (以及disabled)
也就是在IE環境下 無法讓以下的黃色字消失
<option value="1" class="option_1" selected="selected">1</option>
而且selected的值似乎只能是selected或true 沒有none, no這類的選項
我只是來討論我的發現 不期待有什麼解法 我寫的code如下
//both work fine except IE
//1.DOM solution, but IE doesn't act well
//getElementsByClassName("option_1").removeAttribute("selected");
//2.jquery, but not cross IE browser
$(".option_1").removeAttr("selected");
網路上有許多類似的問題,例如:
http://gimp4you.eu.org/sandbox/js/test/removeAttr.html
http://bbs.jquery.org.cn/read.php?tid-830-fpage-86.html
http://www.mail-archive.com/jquery-en@googlegroups.com/msg04018.html
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.116.40.183
※ 編輯: tomin 來自: 122.116.40.183 (05/23 16:12)
→
05/23 16:19, , 1F
05/23 16:19, 1F
我原本要達到的目標是排優先順序
比如說有三個select
1 2 3 飛機
1 2 3 火車
1 2 3 公車
1,2,3不能重覆
移除selected 我是用來移除重覆的選項
比如火車選1後 飛機又再選1 要將火車的1移除
※ 編輯: tomin 來自: 122.116.40.183 (05/23 18:17)
→
05/23 18:22, , 2F
05/23 18:22, 2F
→
05/23 18:22, , 3F
05/23 18:22, 3F
→
05/23 18:27, , 4F
05/23 18:27, 4F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 3 篇):
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章