Skip to content

Commit 4cf1841

Browse files
committed
Types: Clarify behavior of jQuery-object-returning methods, ref jquerygh-338
1 parent 3fe6131 commit 4cf1841

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pages/Types.html

+2
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ <h2 id="jQuery"> jQuery </h2>
585585
</p>
586586
<p>Most frequently, you will use the jQuery() function to create a jQuery object. <code>jQuery()</code> can also be accessed by its familiar single-character alias of <code>$()</code>, unless you have called <code>jQuery.noConflict()</code> to disable this option. Many jQuery methods return the jQuery object itself, so that method calls can be chained:
587587
</p>
588+
<p>In API calls that return <code>jQuery</code>, the value returned will be the original jQuery object unless otherwise documented by that API. API methods such as <code>.filter()</code> or <code>.not()</code> modify their incoming set and thus return a new jQuery object.
589+
</p>
588590
<pre><code data-lang="javascript">$( "p" ).css( "color", "red" ).find( ".special" ).css( "color", "green" );
589591
</code></pre>
590592
<p>Whenever you use a "destructive" jQuery method that potentially changes the set of elements in the jQuery object, such as <code>.filter()</code> or <code>.find()</code>, that method actually returns a new jQuery object with the resulting elements. To return to the previous jQuery object, you use the <code>.end()</code> method.

0 commit comments

Comments
 (0)