删除最后一个append元素jquery

我有以下代码:
$(this).children("a:eq(0)").append('<img src="'+ (arrowsvar.down[1]) 
    +'" class="' + (arrowsvar.down[0])
    + '" style="border:0;" />'
);

现在我想删除最后附加的元素(图像)。请给出建议。

解决方法

你可以使用 :last-child选择器找到最后一个附加的元素,那么你可以 remove它:
$('img:last-child',this).remove();
// get the last img element of the childs of 'this'

相关文章

1.第一步 设置响应头 header(&#39;Access-Control-Allow...
$.inArray()方法介绍 $.inArray()函数用于在数组中搜索指定的...
jquery.serializejson.min.js的妙用 关于这个jquery.seriali...
JS 将form表单数据快速转化为object对象(json对象) jaymou...
jQuery插件之jquery.spinner数字智能增减插件 参考地址:http...