我在我的應用程序中使用jquery自動完成。如何在jquery自動完成中限制用戶可以選擇2的建議?
我想要的是,用戶可以選擇的建議數量應該限制爲2?
我有以下代碼:
<script type="text/javascript">
$(document).ready(function(){
$('#txtTopic').autocomplete('include/ajax.php?option=searchtopics', {
minChars: 2,
max:10, /* maximum number of records to display at one time */
autoFill: true,
multiple: true
});
})
</script>
現在因爲多是真正的用戶能夠選擇2點以上的建議。
他應該只能選擇2條建議。
您準確使用了哪個插件?這些選項是你的例子不支持從'jQuery UI'官方'jQuery Autocomplete' http://jqueryui.com/demos/autocomplete/ – pomeh 2012-04-27 07:32:06
pomesh謝謝你的回覆。我正在使用http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ – 2012-04-27 08:09:11
「注意(2010-06-23):此插件已被棄用,不再開發。」如果可以的話,你應該切換到官方插件:) – pomeh 2012-04-27 08:12:34