$(document).ready(function () { $("#myButton").click(function () { $("#targetP").before("<h3>Jquery is easy to learn.</h3>") }); });
<html> <head> <title>before</title> </head> <body> <p id="targetP">Jquery is amazing.</p> <br /> <input type="button" id="myButton" value="Before"/> <input type="button" id="reset" value="reset" onclick="location.reload()" /> </body> </html>