Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <head> <script src="../../ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> <script> function prependText() { var txt1="<p>Text.</p>"; // Create text with HTML var txt2=$("<p></p>").text("Text."); // Create text with jQuery var txt3=document.createElement("p"); txt3.innerHTML="Text."; // Create text with DOM $("p").prepend(txt1,txt2,txt3); // Prepend new elements } </script> </head> <body> <p>This is a paragraph.</p> <button onclick="prependText()">Prepend text</button> </body> </html>
Result:
W3Schools.com - Try it yourself