jQuery: What’s the difference between after() and insertAfter()
They are mutual opposites. ‘after‘ inserts the argument after the selector. ‘insertAfter‘ inserts the selector after the argument. Here is an example of the same thing done with: insertafter(): <div class=”container”> <h2>Greetings</h2> <div class=”inner”>Hello</div> <div class=”inner”>Goodbye</div> </div> $( “<p>Test</p>” ).insertAfter( “.inner” ); Each inner <div> element gets this new content: <div class=”container”> <h2>Greetings</h2> <div class=”inner”>Hello</div> … Read more