Example of .after() in jQuery
February 18, 2013
.after() in jQuery inserts the element just after the element on which .after() is being called. .after() searches all the those DOM element on which .after() has been called and adds the content specified by .after().
Lets understand by code.
<p> Hellow</p> $('p').after("<p> World</p>");
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <p> Hellow</p> <p> Whole</p> <script> $('p').after("<p> World</p>"); </script> </body> </html>
Output
Hellow
World
Whole
World