jQuery UIオートコンプリートを使用しており、複数の結果を制限しようとしています。基本的に、toフィールドにオートコンプリートを使用しているPMシステムを構築しています。しかし、私は1つのメッセージを送信できる人の数を制限しようとしています。したがって、最大選択数を25に制限します。
これを制限する方法はありますか?また、それらが最大に達したという視覚的指標に関するアイデアはありますか?
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;
}
}
