diff --git a/entries/after.xml b/entries/after.xml index 8c0fe2c3..38b44162 100644 --- a/entries/after.xml +++ b/entries/after.xml @@ -60,7 +60,7 @@ $( ".container" ).after( $( "h2" ) ); </div> <h2>Greetings</h2> -

If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first.

+

Important: If there is more than one target element, however, cloned copies of the inserted element will be created for each target except for the last one.

Inserting Disconnected DOM nodes

As of jQuery 1.4, .before() and .after() will also work on disconnected DOM nodes. For example, given the following code:

$( "<div></div>" ).after( "<p></p>" );
diff --git a/entries/append.xml b/entries/append.xml index d8b4ebb9..5903fa05 100644 --- a/entries/append.xml +++ b/entries/append.xml @@ -66,7 +66,7 @@ $( ".container" ).append( $( "h2" ) ); <h2>Greetings</h2> </div> -

If there is more than one target element, however, cloned copies of the inserted element will be created for each target except for the last one.

+

Important: If there is more than one target element, however, cloned copies of the inserted element will be created for each target except for the last one.

Additional Arguments

Similar to other content-adding methods such as .prepend() and .before(), .append() also supports passing in multiple arguments as input. Supported input includes DOM elements, jQuery objects, HTML strings, and arrays of DOM elements.

For example, the following will insert two new <div>s and an existing <div> as the last three child nodes of the body:

diff --git a/entries/before.xml b/entries/before.xml index 13bfce2c..060897cc 100644 --- a/entries/before.xml +++ b/entries/before.xml @@ -62,7 +62,7 @@ $( ".container" ).before( $( "h2" ) ); <div class="inner">Goodbye</div> </div> -

If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first.

+

Important: If there is more than one target element, however, cloned copies of the inserted element will be created for each target except for the last one.

In jQuery 1.4, .before() and .after() will also work on disconnected DOM nodes:


 $( "<div>" ).before( "<p></p>" );
diff --git a/entries/prepend.xml b/entries/prepend.xml
index df99494c..ca783d51 100644
--- a/entries/prepend.xml
+++ b/entries/prepend.xml
@@ -66,7 +66,7 @@ $( ".container" ).prepend( $( "h2" ) );
     <div class="inner">Goodbye</div>
 </div>
 
-

Important: If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first.

+

Important: If there is more than one target element, however, cloned copies of the inserted element will be created for each target except for the last one.

Additional Arguments

Similar to other content-adding methods such as .append() and .before(), .prepend() also supports passing in multiple arguments as input. Supported input includes DOM elements, jQuery objects, HTML strings, and arrays of DOM elements.

For example, the following will insert two new <div>s and an existing <div> as the first three child nodes of the body: