除去最后追加元素的jQuery [英] remove last append element jquery
本文介绍了除去最后追加元素的jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下的code:
$(this).children("a:eq(0)").append('<img src="'+ (arrowsvar.down[1])
+'" class="' + (arrowsvar.down[0])
+ '" style="border:0;" />'
);
现在我想删除最后的附加元素(图像)。请给点建议。
Now I want to remove last appended element (an image). Please give suggestions.
推荐答案
您可以使用:最后一个孩子选择找到最后附加元素,那么您可以删除该:
You can use the :last-child selector to find the last appended element, then you can remove it:
$('img:last-child', this).remove();
// get the last img element of the childs of 'this'
这篇关于除去最后追加元素的jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文