$(document).ready(function () { $("#myButton").click(function () { $("<span>This is span element.</span><br/>").insertAfter($('#targetP')); }); });
<html> <head> <title>insertAfter</title> </head> <body> <p id="targetP">This is p element. On clicking the button span will be added after the p element.</p> <input type="button" id="myButton" value="Click ME"/> <input type="button" value="Reset" onclick="location.reload()"/> </body> </html>