以下のシナリオがあります.1つの静的テキストボックスとボタンを使用して、動的テキストボックスを追加します。ユーザーがキーワードを入力すると、候補が表示されます [jquery autocomplete]。静的テキスト ボックスの場合、autocomplate 関数は document.ready にあり、動的テキスト ボックスの場合は "onkeypress" にあります。
動的テキストボックスでは、自動提案は正常に機能していますが、問題はフォーカスにあります。フォーカスが提案ドロップダウンに移動していません。
私は以下を試しました
function getLocationList(id)
{
// $('.autocomplete').css('background','none repeat scroll 0 0 #B9E5FB');
$('.autocomplete').autocomplete({ autoFocus: true });//not working
// Ajax Auto suggestion box.. stuff
var optionsLocation, b;
jQuery(function() {
optionsLocation = { serviceUrl: '/App_Handlers/xxx.ashx',
minChars: 2,
delimiter: /(,|;)\s*/,
deferRequestBy: 0, //miliseconds
noCache: false,
width: 300
};
b = $("#" +id).autocomplete(optionsLocation);
});
}
以下も試しましたが、動作しませんでした
$('.autocomplete').focus();
$('.jobCenterArea').blur();
助言がありますか