remove wrapping div and leave all sub-divs intact?

前端 未结 4 1344
青春惊慌失措
青春惊慌失措 2020-12-01 09:35

I have one wrapper div with several sub-divs inside and tags inside those sub-divs as well. I want to remove the wrapper div. I have considered JQuery\'s unwrap, but it ap

4条回答
  •  旧时难觅i
    2020-12-01 10:21

    To add on to @james

    You can do something like this

    var innerDivs = $("#wrapper").html();
    $("#wrapper").remove();
    $("body").append(innerDivs);​ // you will need to change this to append to whatever element you like
    

    jsfiddle example

    http://jsfiddle.net/dAZ9D/

提交回复
热议问题