How can I remove wrapper (parent element) without removing the child?

后端 未结 7 1230
天命终不由人
天命终不由人 2020-12-03 20:48

I would like to remove the parent without removing the child - is this possible?

HTML structure:

7条回答
  •  情深已故
    2020-12-03 21:22

    Could use this API: http://api.jquery.com/unwrap/

    Demo http://jsfiddle.net/7GrbM/

    .unwrap

    Code will look something on these lines:

    Sample Code

    $('.button').click(function(){
        $('.wrapper img').unwrap();
    });
    

提交回复
热议问题