I want to move all the text(html content) after a div(which is again under a div) to another tag.
For example, if i have a page like below, i want to move everything after div2 to body:
<body>
<div id=div1>
<div id=div2></div>
<div id=div3></div>
<script>blah</script>
and much more
</div>
</body>
to
<body>
<div id=div1>
<div id=div2></div>
</div>
<div id=div3></div>
<script>blah</script>
and much more
</body>
How can i do this?
Using
$('#div').appendTo('body');
only moves that div.
You can achieve this using jQuery.
jsfiddle