Thursday, 25 September 2014

How to add segment insertAfter specific id in jQuery?

<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("<p id=3>Hello world!</p>").insertAfter("#1"); }); }); </script> </head> <body> <button>Insert span element after each p element</button> <p id="1">This is a paragraph.</p> <p>This is another paragraph.</p> </body> </html>

No comments:

Post a Comment