select2-jquery:如何动态设置maximumselectionsize [英] select2-jquery: How to set maximumselectionsize dynamically

查看:209
本文介绍了select2-jquery:如何动态设置maximumselectionsize的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我将决定在select2 ui中允许Max选择。我怎么能这样做。我试过

I've a requirement where I'll decide Max selections to be allowed in select2 ui.How can I do that. I tried by

$('#ChnageLnk').on('click',function(){
$('#SelectD').select2({maximumselectionsize :1});
});


推荐答案

编辑

对不起 - 刚检查过。该选项不应全部小写 - 它应该像驼峰一样:

Sorry - just checked. The option should not be all lowercase - it should be camel case like so:

$('#ChnageLnk').on('click',function(){
   $('#SelectD').select2({ maximumSelectionSize: 1 });
});

这里小提琴

这篇关于select2-jquery:如何动态设置maximumselectionsize的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆