首页 > 解决方案 > 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/

标签: javascriptjquerytwitter-bootstrap-3dropdown

解决方案


你快到了。只针对button内部.btn-group

这样做: -

$(document).ready(function() {
  $('.btn-group button').attr('disabled','disabled');
});

运行代码:- http://jsfiddle.net/9ohwkf0u/


推荐阅读