私は午前中ずっとこれに行き詰まっていました: オートコンプリートを動的に使用したいのですが、_renderItem を呼び出して、サーバーが返すすべてのアイテムを表示する必要があります。私は完全に静的に動作するコードを持っていました。ここで、この部分を DOM に動的にもたらす、より柔軟なソリューションである Web が必要です。うまくいくと思っていたものを変更しましたが、うまくいきません。これは私のコードを簡略化したものです:
$(document).ready(function(){
var site_id = 'site_id';
// Use the .autocomplete() method to compile the list based on input from user
$('#itemCode').livequery( function() {
$(this).autocomplete({
source: 'include/autocompletado_promos.php?site_id=' + site_id,
minLength: 1,
select: function(event, ui) {
return false;
}
});
}).data( "autocomplete" )._renderItem = function(ul, item) {
alert("works!");
});
何が問題なのですか?事前にどうもありがとう!!!