के साथ अपरिभाषित jQuery UI स्वत: पूर्ण की संपत्ति '_renderItem' सेट नहीं कर सकता है, मैं अपने jQuery UI स्वत: पूर्ण आइटम को HTML के रूप में प्रस्तुत करने के लिए निम्न कोड का उपयोग कर रहा हूं। आइटम स्वत: पूर्ण नियंत्रण में सही ढंग से प्रस्तुत करते हैं, लेकिन मुझे यह जावास्क्रिप्ट त्रुटि मिल रही है और इसे पिछले स्थानांतरित नहीं किया जा सकता है।एचटीएमएल
फ़ायरफ़ॉक्स JavaScript तर्क नहीं बदला जा सका
क्रोम सेट नहीं कर सकता गुण अपरिभाषित
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);
};
});
सुनिश्चित नहीं की '_renderItem' कारण है कि यह इस त्रुटि फेंक, या क्या मैं करने के लिए क्या करना है है इसे पिछले प्राप्त करें ... किसी भी मदद की सराहना की है।
क्या पृष्ठ पर आईडी '# msg -'' वाला कोई तत्व है? –
हां वहाँ है ... $ ("# msg-to") एक टेक्स्ट इनपुट फ़ील्ड है, जो .autocomplete बाध्यकारी है। –
इससे मदद मिली: http://stackoverflow.com/questions/5590776/why-am-i-getting-this-js-error – Ilmars