Описание тега insertafter

The jQuery .insertAfter() insert every element in the set of matched elements after the target.

The jquery .insertAfter() insert every element in the set of matched elements after the target.

Consider the following HTML:

<div class="container">
  <h2>Greetings</h2>
  <div class="inner">Hello</div>
  <div class="inner">Goodbye</div>
</div>

We can create content and insert it after several elements at once:

$( "<p>Test</p>" ).insertAfter( ".inner" );

Each inner <div> element gets this new content:

<div class="container">
  <h2>Greetings</h2>
  <div class="inner">Hello</div>
  <p>Test</p>
  <div class="inner">Goodbye</div>
  <p>Test</p>
</div>