解决方法
您可以在打开事件或插件初始化之前执行此操作:
$(function(){ $('select').selectmenu(); $('#disable').click(function(){ $('select option:eq(1)').attr("disabled",true); $('select').selectmenu(); }) });
/* demo styles */ body {font-size: 62.5%; font-family:"Verdana",sans-serif; } fieldset { border:0; } label,select,.ui-select-menu { float: left; margin-right: 10px; } select { width: 200px; } .wrap span.ui-selectmenu-item-header,.wrap ul.ui-selectmenu-menu li a { text-decoration: underline !important; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://github.Felixnagel.com/selectmenu/ui/jquery.ui.position.js"></script> <script src="http://github.Felixnagel.com/selectmenu/ui/jquery.ui.widget.js"></script> <link href="http://github.Felixnagel.com/selectmenu/themes/base/jquery.ui.theme.css" rel="stylesheet"/> <link href="http://github.Felixnagel.com/selectmenu/themes/base/jquery.ui.core.css" rel="stylesheet"/> <script src="http://github.Felixnagel.com/selectmenu/ui/jquery.ui.core.js"></script> <link href="http://github.Felixnagel.com/selectmenu/themes/base/jquery.ui.selectmenu.css" rel="stylesheet"/> <script src="http://github.Felixnagel.com/selectmenu/ui/jquery.ui.selectmenu.js"></script> <select name="data[sport]" class="selectmenu" id="sport"> <option value="Kayaking">Kayaking</option> <option value="Rock climbing">Rock climbing</option> <option value="Surfing">Surfing</option> <option value="Skateboarding">Skateboarding</option> </select> <button id='disable'>disable second option</button>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。