ile ayarlanamaz 'jQuery UI otomatik tamamlama öğeleri HTML olarak oluşturmak için aşağıdaki kodu kullanıyorum. Öğeler, otomatik tamamlama denetiminde doğru şekilde oluşturulur, ancak bu javascript hatasını alıyorum ve onu taşıyamam.undefined jQuery kullanıcı arabiriminin '_renderItem' özelliğinin HTML
Firefox JavaScript argüman
Chrome'u dönüştürülemedi neden bu hatayı atma, ya da ne ben yapmak zorunda olduğunu tanımsız
donor.GetFriends(function (response) {
// setup message to friends search autocomplete
all_friends = [];
if (response) {
for (var i = 0; i < response.all.length - 1; i++) {
all_friends.push({
"label":"<img style='padding-top: 5px; width: 46px; height: 46px;' src='/uploads/profile-pictures/" +
response.all[i].image + "'/><br/><strong style='margin-left: 55px; margin-top: -40px; float:left;'>" +
response.all[i].firstname + " " + response.all[i].lastname + "</strong>",
"value":response.all[i].firstname + " " + response.all[i].lastname,
"id":response.all[i].user_id});
}
}
$('#msg-to').autocomplete({
source:all_friends,
select:function (event, ui) {
// set the id of the user to send a message to
mail_message_to_id = ui.item.id;
}
}).data("autocomplete")._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append($("<a></a>").html(item.label))
.appendTo(ul);
};
});
emin değil malı '_renderItem' ayarlanamaz Geçmiş olsun ... Herhangi bir yardım takdir edilir.
Sayfada "# msg-to" yazan bir öğe var mı? –
Evet orada $ ("# msg-to") ... olan .autocomplete için bağlayıcı olduğu, bir metin giriş alanıdır. –
bu yardımcı oldu: http://stackoverflow.com/questions/5590776/why-am-i-getting-this-js-error – Ilmars