我正在检索一个referenceError stating: value is not defined
. 我试图将一个Remove
按钮设置为一个值,以便它删除与该值关联的文本输入。但我不知道要设置什么value
来修复错误,因为var value=''
没有用。我应该设置value
什么?
下面是代码:
function stopImageUpload(success, imageID, imagefilename){
var result = '';
imagecounter++;
if (success == 1){
result = '<span class="imagemsg'+imagecounter+'">The file was uploaded successfully</span>';
$('.hiddenimg').eq(window.lastUploadImageIndex).append('<input type="text" name="imgid[]" id="'+imageID+'" value="' + imageID + '" />');
$('.listImage').eq(window.lastUploadImageIndex).append('<div>' + htmlEncode(imagefilename) + '<button type="button" class="deletefileimage" data-imageID="'+imageID+'" data-image_file_name="' + imagefilename + '" value="'+imageID+'">Remove</button><br/><hr/></div>');
}
var _imagecounter = imagecounter;
$('.listImage').eq(window.lastUploadImageIndex).find(".deletefileimage").on("click", function(event) {
jQuery.ajax("deleteimage.php?imagefilename=" + $(this).attr('data-image_file_name')).done(function(data) {
$(".imagemsg" + _imagecounter).html(data);
});
var buttonid = $(this).attr(value);
$(this).parent().remove();
$("#"+ buttonid +"").remove();
});
return true;
}