after() method in jQuery

after() in jQuery

This method is used to insert content, after each element in the set of matched elements.

Syntax 1


  • content - HTML string, DOM element, text node, array of elements and text nodes, or jQuery object to be inserted before each element.
Syntax 2


  • index - Index position of the element in the set.
  • currentElement - old HTML value of the element.

Example 1

Try Yourself

Example 2 - multiple content

Try Yourself

Example 3 - html content

Try Yourself

Example 4 - content through function

Try Yourself