javascript - 如何禁用下拉列表中的选项,以便箭头键跳到下一个可用选项?

标签 javascript html css

我有一个下拉列表,我需要在其中禁用箭头键的某些选项,以便在按下时跳过禁用的选项并转到下一个可用选项。

here is an example with bootstrap.问题是这个下拉列表是库的一部分,所以我不能只使用 bootstrap

最佳答案

向该选项添加一个 disabled 属性。

<select>
    <option>option 1</option>
    <option disabled>option 2</option>
    <option>option 3</option>
</select>

关于javascript - 如何禁用下拉列表中的选项,以便箭头键跳到下一个可用选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57416389/

相关文章:

javascript - 如何将自定义属性传递给函数?

javascript - 如何在 IOS 上停止背景滚动?

javascript - 使用 .call/.apply 隐藏类方法

javascript - 使用鼠标悬停更改颜色以使用 Angular 工作

javascript - 关于Vue双向数据绑定(bind): what if form field content doesn't come from direct user input?

javascript - 我想检测鼠标移动事件期间鼠标右键还是左键按下

javascript - 如何使用scrapy爬取在下一个按钮中隐藏url为href ="javascript:;"的网站

html - 在 Vuejs Template 中使用时,Bootstrap 图标不会出现在前端

html - 悬停时显示 IE6 li

css - 将元素隐藏在 ImageMap 后面