jQuery has an .after()
method, and also an .insertAfter()
method.
What\'s the difference between them? I think I can use .after()
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:
$( "Greetings
HelloGoodbyeTest
" ).insertAfter( ".inner" ); Each innerelement gets this new content:Greetings
HelloTest
GoodbyeTest
after():
$( ".inner" ).after( "Greetings
HelloGoodbyeTest
" );Greetings
HelloTest
GoodbyeTest