2
我正在使用jQuery UI自动完成,我试图限制多个结果。基本上,我正在构建一个PM系统,我正在使用自动填充功能来实现。但我试图限制一条消息可以发送到的人数。所以像限制最大选择25.jqueryui自动完成限制多选
有没有什么办法来限制?还有关于视觉指标的任何想法,他们已达到最大值?
select: function(event, ui){
var terms = split(this.value);
if(terms.length <= 2)
{
// remove the current input
terms.pop();
// add the selected item
terms.push(ui.item.value);
// add placeholder to get the comma-and-space at the end
terms.push("");
this.value = terms.join(", ");
return false;
}
else
{
$(this).effect("highlight", {}, 1000);
$(this).addClass("red");
$("#warnings").html("<span style='color:red;'>Max people reached</span>");
return false;
}
}
好了,所以在我的原来的职位,我添加了一些代码。无论如何,我可以删除最新添加到框中?就像我想保留其他名称一样,但我想删除用户添加的最近一个。 http://theproductguy.com/noblecount/noblecount.demo.html在达到允许的最大字符时会执行此类操作。 – jefffan24 2011-01-27 01:02:59