当上传完成时,我在下面有一个 jquery 函数,它将文件名存储在字符串中,并将其 id 存储在文本输入中。现在在功能的底部,如果用户单击deletevideofile
按钮,则可以删除文件名,这很好,但我的问题是如何删除文本输入?我似乎无法删除要删除的文本输入。
下面是代码:
function stopVideoUpload(success, videoID, videofilename){
var result = '';
videocounter++;
if (success == 1){
result = '<span class="videomsg'+videocounter+'">The file was uploaded successfully</span>';
$('.listVideo').eq(window.lastUploadVideoIndex).append('<input type="text" name="vidid" value="' + videoID + '" />');
$('.listVideo').eq(window.lastUploadVideoIndex).append('<div>' + htmlEncode(videofilename) + '<button type="button" class="deletefilevideo" video_file_name="' + videofilename + '">Remove</button><br/><hr/></div>'); }
var _videocounter = videocounter;
$('.listVideo').eq(window.lastUploadVideoIndex).find(".deletefilevideo").on("click", function(event) {
var video_file_name = $(this).attr('video_file_name');
jQuery.ajax("deletevideo.php?videofilename=" + video_file_name)
.done(function(data) {
$(".videomsg" + _videocounter).html(data);
});
$(this).parent().remove();
});
return true;
}