Home
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function () { $('<p style="color: red">This is paragraph.</p>').prependTo('div'); $('<p style="color: red">This is paragraph.</p>').prependTo('span'); }); </script> </head> <body> <h1>jQuery Manipulation Methods: prependTo()</h1> <div style="border:1px solid red;">This is div tag</div> <span>This is span tag</span> </body> </html>
Result: