我使用Jquery显示复选框的下拉列表。
<select id="category_type" multiple="multiple" class="category" tabindex="-1" placeholder="Category">
<option></option>
.
.
</select>在某些情况下,我需要在单击时限制下拉复选框的打开。
我试过
jQuery("#category_type").bind( "change", function(e) {
jQuery.mobile.selectmenu.prototype.options.hidePlaceholderMenuItems = false;
e.preventDefault();
});但效果不佳。这怎么可能?提前感谢
发布于 2014-11-24 08:44:52
Note:这是工作DEMO
HTML部件:
<div data-role="fieldcontain">
<button id="disable_select">Disable</button>
<select name="select-choice-1" id="select-choice-1">
<option value="standard">Standard: 7 day</option>
<option value="rush">Rush: 3 days</option>
<option value="express">Express: next day</option>
<option value="overnight">Overnight</option>
</select>
</div>JS部分:
$("#disable_select").click(function() {
$("#select-choice-1").attr("disabled","disabled");
});现在我已经添加了一个按钮来禁用该按钮的下拉菜单,您可以添加您的条件来禁用它。
https://stackoverflow.com/questions/27098582
复制相似问题