JQuery Prepend

 

prepend() method is used to Inserts content at the start of the selected elements.

 
 
 
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").prepend(" prepended Text."); }); }); </script> </head> <body> <p>This is a Heading.</p> <button>prepend text</button> </body> </html>
Output