MDI*_*DIT 0 jquery jquery-plugins
我正在使用Choosen jquery插件,我想在multiselect中限制选定的选项.有一个建议的解决方案, $(".chosen-select").chosen({max_selected_options: 5});但它不适合我!
这是我的js文件:
$(document).ready(function(){
// .....
$(".chosen-select").chosen({max_selected_options: 5});
//.....
});
Run Code Online (Sandbox Code Playgroud)
这是php文件:
<em>Country</em>
<select data-placeholder="Choose your country..." id="mycountry" class="chosen-select" multiple style="width:400px;" tabindex="4">
<option value=""></option>
<?php
// Data from dataabse
?>
</select>
Run Code Online (Sandbox Code Playgroud)
这段代码适合我 -
$(".demo-chosen-select").chosen({
max_selected_options:3, //Max select limit
display_selected_options:true,
placeholder_text_multiple:"Select some options",
no_results_text:"Results not found",
enable_split_word_search:true,
search_contains:false,
display_disabled_options:true,
single_backstroke_delete:false,
width:"200px",
inherit_select_classes:true
});
Run Code Online (Sandbox Code Playgroud)
而已..