You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p><strong>Important</strong>: 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.</p>
83
-
<h4id="disconnected-dom-nodes">Inserting Disconnected DOM nodes</h4>
84
-
<p>As of jQuery 1.4, <code>.before()</code> and <code>.after()</code> will also work on disconnected DOM nodes. For example, given the following code:</p>
<p>The result is a jQuery set containing a div and a paragraph, in that order. That set can be further manipulated, even before it is inserted in the document.</p>
87
-
<pre><code>
88
-
$( "<div></div>" )
89
-
.after( "<p></p>" )
90
-
.addClass( "foo" )
91
-
.filter( "p" )
92
-
.attr( "id", "bar" )
93
-
.html( "hello" )
94
-
.end()
95
-
.appendTo( "body" );
96
-
</code></pre>
97
-
<p>This results in the following elements inserted just before the closing <code></body></code> tag:</p>
98
-
<pre><code>
99
-
<div class="foo"></div>
100
-
<p class="foo" id="bar">hello</p>
101
-
</code></pre>
102
83
<h4id="passing-a-function">Passing a Function</h4>
103
84
<p>As of jQuery 1.4, <code>.after()</code> supports passing a function that returns the elements to insert.</p>
0 commit comments