javascript - Disable Dropdown Button
问题描述
I know this very simple but I have been looking everywhere and tried some codes. Most of the codes I have searched were how to disable a drop down list which would send me to a series of select elements being disabled. What I want is to disable the whole button of the drop down that composes the drop down items. I've tried couldn't get the right codes for the program. I have a fiddle below. PS this is only an example fiddle that i want to disable.
I am trying this:-
$(document).ready(function() {
$('.btn-group').attr('disable', true)
});
full non-working code:-http://jsfiddle.net/ydxq1ue9/
解决方案
你快到了。只针对button
内部.btn-group
。
这样做: -
$(document).ready(function() {
$('.btn-group button').attr('disabled','disabled');
});
推荐阅读
- jenkins - 如何在 Jenkins 管道中通过 bat 设置环境变量
- javascript - 理解回调函数中的“this”
- prolog - NU-Prolog 和 Gödel 的逻辑和合理的 `if-then-else` 扩展
- swift - 如何组成一个组合发布者,将最后发出的值发送给它的第二个订阅者
- spring-websocket - 如何从 Spring WebSocket STOMP 中的 UNSUBSCRIBE 框架获取订阅目的地
- javascript - 如何映射包含哈希图的数组并找到匹配的键值对
- postgresql - Elixir / Ecto Embedded struct - updated_at 未更新
- reactjs - 为 API 返回的深度嵌套对象添加 Typescript 接口
- linux - 实现永远等待的汇编代码
- node.js - 使用节点 js 遵循快速入门 gmail api 时出错