テキストボックスのjqueryオートコンプリートは、オートコンプリートリスト以外のデータを許可すべきではありません。しかし、問題は私がリストのオートコンプリートリストユーザーが他のデータを入力しても、オートコンプリートリストから選択してメッセージを表示する必要があります。以下テキストボックスのjqueryオートコンプリートは、オートコンプリートリスト以外のデータを許可しないでください。
リンクショーはまた、オートコンプリートの提案以外のデータを許可されています
$("#field").autocomplete({
source: countries_starting_with_A,
minLength: 1,
select: function(event, ui) {
// feed hidden id field
$("#field_id").val(ui.item.id);
// update number of returned rows
$('#results_count').html('');
},
open: function(event, ui) {
// update number of returned rows
var len = $('.ui-autocomplete > li').length;
$('#results_count').html('(#' + len + ')');
},
close: function(event, ui) {
// update number of returned rows
$('#results_count').html('');
},
// mustMatch implementation
change: function (event, ui) {
if (ui.item === null) {
$(this).val('');
$('#field_id').val('');
}
}
});
http://jsfiddle.net/handtrix/32Bck/
お手数をおかけしていただきありがとうございます。makeSelect = trueを指定すると、要件は正常に動作します。 – ManiShankar