remove last append element jquery

后端 未结 5 937
慢半拍i
慢半拍i 2020-12-23 17:50

I have the following code:

$(this).children(\"a:eq(0)\").append(\'

        
5条回答
  •  南方客
    南方客 (楼主)
    2020-12-23 18:30

    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'
    

提交回复
热议问题