Prev Demo
jQuery
>
.Prependto() - Prepend Content To Target Element
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> </head> <body> <div id="div1">This is the DIV 1</div> <div id="div2">This is the DIV 2</div> <div id="div3">This is the DIV 3</div> <div id="div4">This is the DIV 4</div> <p style="color:green;"> This is a paragraph text. </p> <script> $("p").prependTo("#div2"); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output