jquery remove html elements inside variable (jquery object)

前端 未结 3 1831
滥情空心
滥情空心 2021-01-04 11:28

Inside HTML I have this DIV:


// usually one thumb imag
3条回答
  •  说谎
    说谎 (楼主)
    2021-01-04 12:08

    No need for html()

    var teaser = $(".teaser").find("img").remove();
    

    EDIT:

    Try this:

    var teaser = $(".teaser").clone();
    teaser.find("img").remove()
    // use teaser
    

提交回复
热议问题