Disable one option value inside select tag not working in IE6Ha

為{幸葍}努か 提交于 2019-12-11 12:57:31

问题


I have a select box with 4 values (a,b,c,d). I just want to disable 'c' inside the dropdown. I used disabled property, it is working in all browsers but not in IE6.

I want to make it work on IE6. Could you give me some fix for this issue.

thanks


回答1:


The disabled attribute for the option element is not supported in IE versions prior to 8.

The easiest thing to do would be to just completely remove that option from the select menu if you don't want anyone to select it. You should not be using the disabled attribute at all. It's simple: if you don't want someone to select it, don't put it in the list.




回答2:


Unfortunately, I don't think it is possible. The work-around I've used in the past was to set the color of options that should be disabled to grey, and if one of those options were selected, I'd deselect it immediately using onchange().



来源:https://stackoverflow.com/questions/2025804/disable-one-option-value-inside-select-tag-not-working-in-ie6ha

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!