$(document).ready(function () { $("#myButton").click(function () { $("#targetP").prepend("This is 20 Fingers and 2 Brains."); }); });
<html> <head> <title>prepend</title> </head> <body> <p id="targetP">This is p element.</p><br /> <input type="button" id="myButton" value="Prepend"/> <input type="button" id="reset" value="Reset" onclick="location.reload()" /> </body> </html>