用jQuery删除特定的框 [英] Remove specific box with jquery
本文介绍了用jQuery删除特定的框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当您单击添加框时.它添加了一个带有deletlistbtn的框. 现在,它将删除所有具有相同名称/类/变量的框. 但我希望按钮仅删除该框/将其列出. 谁能告诉我我应该使用哪段代码来做到这一点?
When you click Add a box. It adds a box with a deletlistbtn. Right now it removes all boxes with the same name/class/var. But i want the button to only delete the box/list its in. Can anyone tell me wich code i should use to accomplish that?
现在我使用此代码;
$('.deletelistbtn').live('click', function() {
$(redbox).remove();
});
这是我的整个代码 http://jsfiddle.net/XsCAN/
推荐答案
使用$(this).parent().remove()
或类似的方法. ($(this).parent().parent().remove()
-取决于您要完成什么)
Use $(this).parent().remove()
or something similar. ($(this).parent().parent().remove()
- depending what are you going to accomplish)
这篇关于用jQuery删除特定的框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文