Make some options in a select menu “unselectable”

后端 未结 5 1919
广开言路
广开言路 2020-12-12 21:52

I have a select element with a few options, but I want some of the options to not be selectable.

Basically it\'s like this:



        
5条回答
  •  春和景丽
    2020-12-12 22:23

    You're probably looking for an :

    Demo: http://jsfiddle.net/Zg9Mw/

    If you do need to make regular elements unselectable, you can give them the disabled attribute (it's a boolean attribute, so the value doesn't matter at all):

    
    

提交回复
热议问题