From ba9e5fbc695d24f666626733722be08102329897 Mon Sep 17 00:00:00 2001
From: Mike Pennisi 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. As of jQuery 1.4, 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. Similar to other content-adding methods such as For example, the following will insert two new 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, 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. Similar to other content-adding methods such as For example, the following will insert two new Inserting Disconnected DOM nodes
.before()
and .after()
will also work on disconnected DOM nodes. For example, given the following code:
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>
- $( "<div></div>" ).after( "<p></p>" );
Additional Arguments
.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.<div>
s and an existing <div>
as the last three child nodes of the body:.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>
Additional Arguments
.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.<div>
s and an existing <div>
as the first three child nodes of the body: