HTML form readonly SELECT tag/input

前端 未结 30 2907
陌清茗
陌清茗 2020-11-22 08:28

According to HTML specs, the select tag in HTML doesn\'t have a readonly attribute, only a disabled attribute. So if you want to keep

30条回答
  •  眼角桃花
    2020-11-22 09:10

    If the select dropdown is read-only since birth and does not need to change at all, perhaps you should use another control instead? Like a simple

    (plus hidden form field) or an ?

    Added: If the dropdown is not read-only all the time and JavaScript is used to enable/disable it, then this is still a solution - just modify the DOM on-the-fly.

提交回复
热议问题