在server.javascript jquery中删除文件时如何删除网站中的str(name+;size+;cancel)
我使用ajaxsubmit将文件上传到linux服务器。成功上传文件后,文件名+文件大小+取消按钮将出现在我的网站上。以下是我的html代码:在server.javascript jquery中删除文件时如何删除网站中的str(name+;size+;cancel),javascript,jquery,css,ajax,Javascript,Jquery,Css,Ajax,我使用ajaxsubmit将文件上传到linux服务器。成功上传文件后,文件名+文件大小+取消按钮将出现在我的网站上。以下是我的html代码: <style type="text/css"> .files{height:10px; font-size:10px;line-height:22px; margin:10px 0} </style> <div class="files"></div> 不幸的是,它失败了。下面是我想实现的示例。在单击“取
<style type="text/css">
.files{height:10px; font-size:10px;line-height:22px; margin:10px 0}
</style>
<div class="files"></div>
不幸的是,它失败了。下面是我想实现的示例。在单击“取消”之前,我的文件div内容是:
1.jpg(10.36k) cancel
2.jpg(10.36k) cancel
3.jpg(10.36k) cancel
单击第二个按钮后,我的文件div内容为:
1.jpg(10.36k) cancel
3.jpg(10.36k) cancel
谁能帮我?问题是
id='dataname
不能使用同一id
的倍数改为使用类。 在这里 所以…
而不是
并删除无用的id='cancelbtn'
然后,单击事件处理程序应为:
$(document).on('click',".delimg",function(){
$(this).prev('.dataname').remove(); // removes the filename
$(this).remove(); // Removes the "cancel"
});
这里不需要正则表达式。您有一些类以要删除的元素为目标
正则表达式用于以字符串中的字符模式为目标。问题在于
id='dataname
不能使用同一id
的倍数改为使用类。 在这里 所以…
而不是
并删除无用的id='cancelbtn'
然后,单击事件处理程序应为:
$(document).on('click',".delimg",function(){
$(this).prev('.dataname').remove(); // removes the filename
$(this).remove(); // Removes the "cancel"
});
这里不需要正则表达式。您有一些类以要删除的元素为目标
正则表达式用于以字符串中的字符模式为目标。,如何使用类?你能告诉我密码吗?对不起,我不知道如何使用课堂。我用一些具体的东西改进了答案。;),如何使用类?你能告诉我密码吗?对不起,我不知道如何使用课堂。我用一些具体的东西改进了答案
$(document).on('click',".delimg",function(){
$(this).prev('.dataname').remove(); // removes the filename
$(this).remove(); // Removes the "cancel"
});