Javascript examples for jQuery Method and Property:prepend
Switch child div to become parent
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.6.2.js"></script> <script type="text/javascript"> $(window).load(function(){//ww w .j a va2s . co m $('#parent1').prepend($('#child1')) }); </script> </head> <body> <div id="parent1"> parent1 </div> <div id="parent2"> <div id="child1"> some text in here </div> </div> </body> </html>