jQuery remove duplicated div with class name

后端 未结 3 1311

So basically my div generates like this:

content
content
<
3条回答
  •  时光说笑
    2021-01-05 09:29

    something like this:

    ​$('.className').not(':last')​.remove();​​​​​​​​​​​​​
    

    select all divs with .className, remove the last one from the selection, remove the collection of divs, and you will just keep the last one.

    demo: http://jsfiddle.net/j5728/

提交回复
热议问题