1
我正在一个$("<div/>").text(value).html 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></div>'
);
return true;
}
如何这个错误是固定的?
奇怪的是,我有以下类似的代码,但不同的功能(stopImageUpload)和代码工作如下罚款:
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>'
);
return true;
}
链接到应用程序,看看发生了什么事是在这里:application
我认为不需要退货 –
你得到什么价值? HTML或文本? – sree