.after() | jQuery API Documentation

PHOTO EMBED

Thu Jul 21 2022 00:42:55 GMT+0000 (Coordinated Universal Time)

Saved by @kalehm

Using the following HTML:

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


Content can be created and then inserted after several elements at once:

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


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>
content_copyCOPY

https://api.jquery.com/after/