-2
我正在一個$("<div/>").text(value).html is not a function is not a function
錯誤代碼如下:如何解決以下,說明這個錯誤,這是不是一個功能
function htmlEncode(value) {
return $('<div/>').text(value).html();
}
function startImageUpload(imageuploadform, imagefilename){
$('.imagef1_cancel').eq(window.lastUploadImageIndex).html(
'<div>' +
htmlEncode(imagefilename) +
'<button type="button" class="imageCancel" cancel_image_file_name="' +
imagefilename +
'">CANCEL</button><br/><hr/></div>'
);
$('.imagef1_cancel').eq(window.lastUploadImageIndex)
.find(".imageCancel")
.on("click", function(event) {
var cancel_image_file_name = $(this).attr('cancel_image_file_name');
console.log(cancel_image_file_name)
jQuery.ajax("cancelimage.php?imagefilename=" + cancel_image_file_name)
return stopImageUpload(2, cancel_image_file_name);
});
return true;
}
但我不明白的IIS,它的工作原理與下面的代碼這非常相似。
function htmlEncode(value) {
return $('<div/>').text(value).html();
}
function stopImageUpload(success, imagefilename) {
imagecounter++;
$('.listImage').eq(window.lastUploadImageIndex).append(
'<div>' +
htmlEncode(imagefilename) +
'<button type="button" class="deletefileimage" image_file_name="' +
imagefilename +
'">Remove</button><br/><hr/></div>'
);
var _imagecounter = imagecounter;
$('.listImage').eq(window.lastUploadImageIndex)
.find(".deletefileimage")
.on("click", function(event) {
var image_file_name = $(this).attr('image_file_name');
jQuery.ajax("deleteimage.php?imagefilename=" + image_file_name)
.done(function(data) {
$(".imagemsg" + _imagecounter).html(data);
}
);
$(this).parent().remove();
}
);
return true;
}
爲什麼會這樣以及如何糾正錯誤?
該消息是否真的說或你添加了一個額外的'.'? –
對不起,這是一個錯字,我已經重新輸入錯誤信息,這次它是錯誤控制檯的錯誤信息 – user1394925