bootstrap下拉菜单打开onclickof按钮?

时间:2016-02-16 06:46:48

标签: jquery html css twitter-bootstrap

please refer the link

所需功能 - 最初下拉列表处于禁用状态。当我选中复选框下拉列表时,必须打开并以正常方式运行。我刚添加了这一行$('.btn').removeClass('disabled');

1 个答案:

答案 0 :(得分:0)

希望以下示例能为您提供帮助。



$(function() {
  $("#buttonId").click(function(event) {
    $("#dropdownId").removeAttr('disabled');
    $("#dropdownId").attr('size',6);
  });
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>


<input type="button" id="buttonId" value="Click me to enable dropdown">
<br>
<br>
<select id="dropdownId" disabled>
  <option value="Sunday">Sunday</option>
  <option value="Monday">Monday</option>
  <option value="Tuesday">Tuesday</option>
  <option value="Wednesday">Wednesday</option>
  <option value="Thursday">Thursday</option>
  <option value="Friday">Friday</option>
  <option value="Saturday">Saturday</option>
</select>
&#13;
&#13;
&#13;

根据需要更新了src