<?xml version="1.0" ?>
<docs version="1.2.6" startdoc="API" timestamp="2008-06-03T15:40:58Z"><cat value="Core"><subcat value="$(...) The jQuery Function"><function cat="Core" name="jQuery" return="jQuery" timestamp="2007-11-17T11:56:36Z"><added>1.0</added><desc>This function accepts a string containing a CSS selector which is then used to match a set of elements.</desc><longdesc>The core functionality of jQuery centers around this function. Everything in jQuery is based upon this, or uses this in some way. The most basic use of this function is to pass in an expression (usually consisting of CSS), which then finds all matching elements.

By default, if no context is specified, $() looks for DOM elements within the context of the current HTML document. If you do specify a context, such as a DOM element or jQuery object, the expression will be matched against the contents of that context.

See <![CDATA[<a href='Selectors'>Selectors</a>]]> for the allowed CSS syntax for expressions. </longdesc><params name="expression" type="String"><desc>An expression to search with.</desc></params><params name="context" optional="true" type="Element, jQuery"><desc>A DOM Element, Document or jQuery to use as context</desc></params><example><desc>Finds all p elements that are children of a div element.</desc><code>$(&quot;div &gt; p&quot;).css(&quot;border&quot;, &quot;1px solid gray&quot;);</code><html>&lt;p&gt;one&lt;/p&gt; &lt;div&gt;&lt;p&gt;two&lt;/p&gt;&lt;/div&gt; &lt;p&gt;three&lt;/p&gt;</html><results>[ &lt;p&gt;two&lt;/p&gt; ]</results></example><example><desc>Finds all inputs of type radio within the first form in the document.</desc><code>$(&quot;input:radio&quot;, document.forms[0]);</code></example><example><desc>Finds all div elements within an XML document from an AJAX response.</desc><code>$(&quot;div&quot;, xml.responseXML);</code></example></function><function cat="Core" name="jQuery" return="jQuery" timestamp="2007-11-17T11:56:36Z"><added>1.0</added><desc>Create DOM elements on-the-fly from the provided String of raw HTML.</desc><longdesc>You can pass in plain HTML Strings written by hand, create them using some template engine or plugin, or load them via AJAX. There are limitations when creating input elements, see the second example. Also when passing strings that may include slashes (such as an image path), escape the slashes.  When creating single elements use the closing tag or XHTML format.  For example, to create a span use $(&quot;&lt;span/&gt;&quot;) or $(&quot;&lt;span&gt;&lt;/span&gt;&quot;) instead of without the closing slash/tag.</longdesc><params name="html" type="String"><desc>A string of HTML to create on the fly.</desc></params><example><desc>Creates a div element (and all of its contents) dynamically, and appends it to the body element. Internally, an element is created and its innerHTML property set to the given markup. It is therefore both quite flexible and limited.</desc><code>$(&quot;&lt;div&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;/div&gt;&quot;).appendTo(&quot;body&quot;)</code></example><example><desc>Do not create &amp;lt;input&amp;gt;-Elements without a type-attribute, due to Microsofts read/write-once-rule for the type-attribute of &amp;lt;input&amp;gt;-elements, see this [http://msdn2.microsoft.com/en-us/library/ms534700.aspx official statement] for details.</desc><code>// Does NOT work in IE:
$(&quot;&lt;input/&gt;&quot;).attr(&quot;type&quot;, &quot;checkbox&quot;);
// Does work in IE:
$(&quot;&lt;input type='checkbox'/&gt;&quot;);</code></example></function><function cat="Core" name="jQuery" return="jQuery" timestamp="2007-11-17T11:56:36Z"><added>1.0</added><desc>Wrap jQuery functionality around a single or multiple DOM Element(s).</desc><longdesc>This function also accepts XML Documents and Window objects as valid arguments (even though they are not DOM Elements).</longdesc><params name="elements" type="Element, Array&lt;Element&gt;"><desc>DOM element(s) to be encapsulated by a jQuery object.</desc></params><example><desc>Sets the background color of the page to black.</desc><code>$(document.body).css( &quot;background&quot;, &quot;black&quot; );</code></example><example><desc>Hides all the input elements within a form.</desc><code>$(myForm.elements).hide()</code></example></function><function cat="Core" name="jQuery" return="jQuery" timestamp="2007-11-17T11:56:36Z"><added>1.0</added><desc>A shorthand for $(document).ready().</desc><longdesc>Allows you to bind a function to be executed when the DOM document has finished loading. This function behaves just like $(document).ready(), in that it should be used to wrap other $() operations on your page that depend on the DOM being ready to be operated on. While this function is, technically, chainable - there really isn't much use for chaining against it.

You can have as many $(document).ready events on your page as you like.

See ready(Function) for details about the ready event. </longdesc><params name="callback" type="Function"><desc>The function to execute when the DOM is ready.</desc></params><example><desc>Executes the function when the DOM is ready to be used.</desc><code>$(function(){
  // Document is ready
});</code></example><example><desc>Uses both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias.</desc><code>jQuery(function($) {
  // Your code using failsafe $ alias here...
});</code></example></function></subcat><subcat value="jQuery Object Accessors"><function cat="Core" name="each" return="jQuery" timestamp="2007-10-12T06:03:00Z"><added>1.0</added><desc>Execute a function within the context of every matched element.</desc><longdesc>This means that every time the passed-in function is executed (which is once for every element matched) the 'this' keyword points to the specific DOM element.

Additionally, the function, when executed, is passed a single argument representing the position of the element in the matched set (integer, zero-index).

Returning 'false' from within the each function completely stops the loop through all of the elements (this is like using a 'break' with a normal loop). Returning 'true' from within the loop skips to the next iteration (this is like using a 'continue' with a normal loop). </longdesc><params name="callback" type="Function"><desc>The callback to execute for each matched element.
&lt;pre&gt;function callback(index, domElement) {
  this; // this == domElement
}
&lt;/pre&gt;</desc></params><example><desc>Iterates over three divs and sets their color property.</desc><code>
    $(document.body).click(function () {
      $(&quot;div&quot;).each(function (i) {
        if (this.style.color != &quot;blue&quot;) {
          this.style.color = &quot;blue&quot;;
        } else {
          this.style.color = &quot;&quot;;
        }
      });
    });
</code><css>
  div { color:red; text-align:center; cursor:pointer; 
        font-weight:bolder; width:300px; }
  </css><html>&lt;div&gt;Click here&lt;/div&gt;
  &lt;div&gt;to iterate through&lt;/div&gt;
  &lt;div&gt;these divs.&lt;/div&gt;</html></example><example><desc>If you want to have the jQuery object instead of the regular DOM element, use the $(this) function, for example:</desc><code>
    $(&quot;span&quot;).click(function () {
      $(&quot;li&quot;).each(function(){
        $(this).toggleClass(&quot;example&quot;);
      });
    });
</code><css>
  ul { font-size:18px; margin:0; }
  span { color:blue; text-decoration:underline; cursor:pointer; }
  .example { font-style:italic; }
  </css><html>To do list: &lt;span&gt;(click here to change)&lt;/span&gt;
  &lt;ul&gt;
    &lt;li&gt;Eat&lt;/li&gt;
    &lt;li&gt;Sleep&lt;/li&gt;
    &lt;li&gt;Be merry&lt;/li&gt;
  &lt;/ul&gt;</html></example><example><desc>You can use 'return' to break out of each() loops early.</desc><code>
    $(&quot;button&quot;).click(function () {
      $(&quot;div&quot;).each(function (index, domEle) {
        // domEle == this
        $(domEle).css(&quot;backgroundColor&quot;, &quot;yellow&quot;); 
        if ($(this).is(&quot;#stop&quot;)) {
          $(&quot;span&quot;).text(&quot;Stopped at div index #&quot; + index);
          return false;
        }
      });
    });
</code><css>
  div { width:40px; height:40px; margin:5px; float:left;
        border:2px blue solid; text-align:center; }
  span { color:red; }
  </css><html>&lt;button&gt;Change colors&lt;/button&gt; 
  &lt;span&gt;&lt;/span&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div id=&quot;stop&quot;&gt;Stop here&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></function><property cat="Core" name="length" return="Number" timestamp="2008-01-16T20:41:19Z"><desc>The number of elements in the jQuery object.</desc><longdesc>The number of elements currently matched. The <![CDATA[<a href='Core/size'>size</a>]]> function will return the same value.</longdesc><example><desc>Count the divs.  Click to add more.</desc><code> 
    $(document.body).click(function () {
      $(document.body).append($(&quot;&lt;div&gt;&quot;));
      var n = $(&quot;div&quot;).length;
      $(&quot;span&quot;).text(&quot;There are &quot; + n + &quot; divs.&quot; +
                     &quot;Click to add more.&quot;);
    }).trigger('click'); // trigger the click to start
</code><css>
  body { cursor:pointer; }
  div { width:50px; height:30px; margin:5px; float:left;
        background:green; }
  span { color:red; }
  </css><html>&lt;span&gt;&lt;/span&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></property><function cat="Core" name="eq" return="jQuery" timestamp="2007-12-20T03:30:46Z"><added>1.0</added><desc>Reduce the set of matched elements to a single element.</desc><longdesc>The position of the element in the set of matched elements starts at 0 and goes to length - 1.</longdesc><params name="position" type="Number"><desc>The index of the element to select.</desc></params><removed>1.2</removed><deprecated><![CDATA[<a href='Traversing/slice'>slice</a>]]></deprecated><example><desc>Reduces the selection to the second selected element.</desc><code>$(&quot;p&quot;).eq(1).css(&quot;color&quot;, &quot;red&quot;)</code><html>&lt;p&gt;This is just a test.&lt;/p&gt;&lt;p&gt;So is this&lt;/p&gt;</html><results>[ &lt;p&gt;So is this&lt;/p&gt; ]</results></example></function><function cat="Core" name="get" return="Array&lt;Element&gt;" timestamp="2007-11-02T02:07:00Z"><added>1.0</added><desc>Access all matched DOM elements.</desc><longdesc>This serves as a backwards-compatible way of accessing all matched elements (other than the jQuery object itself, which is, in fact, an array of elements).

It is useful if you need to operate on the DOM elements themselves instead of using built-in jQuery functions. </longdesc><example><desc>Selects all divs in the document and returns the DOM Elements as an Array, then uses the built-in reverse-method to reverse that array.</desc><code>
    function disp(divs) {
      var a = [];
      for (var i = 0; i &lt; divs.length; i++) {
        a.push(divs[i].innerHTML);
      }
      $(&quot;span&quot;).text(a.join(&quot; &quot;));
    }
    
    disp( $(&quot;div&quot;).get().reverse() );
</code><css>
  span { color:red; }
  </css><html>Reversed - &lt;span&gt;&lt;/span&gt;
  &lt;div&gt;One&lt;/div&gt;
  &lt;div&gt;Two&lt;/div&gt;
  &lt;div&gt;Three&lt;/div&gt;</html></example></function><function cat="Core" name="get" return="Element" timestamp="2007-11-02T02:07:00Z"><added>1.0</added><desc>Access a single matched DOM element at a specified index in the matched set.</desc><longdesc>This allows you to extract the actual DOM element and operate on it directly without necessarily using jQuery functionality on it. This function called as $(this).get(0) is the equivalent of using square bracket notation on the jQuery object itself like $(this)[0].</longdesc><params name="index" type="Number"><desc>Access the element in the Nth position.</desc></params><example><desc>Gives the tag name of the element clicked on.</desc><code>
    $(&quot;*&quot;, document.body).click(function (e) {
      e.stopPropagation();
      var domEl = $(this).get(0);
      $(&quot;span:first&quot;).text(&quot;Clicked on - &quot; + domEl.tagName);
    });
</code><css>
  span { color:red; }
  div { background:yellow; }
  </css><html>&lt;span&gt;&amp;nbsp;&lt;/span&gt;
  &lt;p&gt;In this paragraph is an &lt;span&gt;important&lt;/span&gt; section&lt;/p&gt;
  &lt;div&gt;&lt;input type=&quot;text&quot; /&gt;&lt;/div&gt;</html></example></function><function cat="Core" name="index" return="Number" timestamp="2007-10-12T05:51:36Z"><added>1.0</added><desc>Searches every matched element for the object and returns the index of the element, if found, starting with zero.</desc><longdesc>Returns -1 if the object wasn't found.</longdesc><params name="subject" type="Element "><desc>Object to search for.</desc></params><example><desc>On click, returns the index (based zero) of that div in the page.</desc><code>
    $(&quot;div&quot;).click(function () {
      // this is the dom element clicked
      var index = $(&quot;div&quot;).index(this);
      $(&quot;span&quot;).text(&quot;That was div index #&quot; + index);
    });
</code><css>
  div { background:yellow; margin:5px; }
  span { color:red; }
  </css><html>&lt;span&gt;Click a div!&lt;/span&gt;
  &lt;div&gt;First div&lt;/div&gt;
  &lt;div&gt;Second div&lt;/div&gt;
  &lt;div&gt;Third div&lt;/div&gt;</html></example><example><desc>Returns the index for the element with ID foobar.</desc><code>$(&quot;*&quot;).index( $('#foobar')[0] )</code><html>&lt;div id=&quot;foobar&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;span id=&quot;foo&quot;&gt;&lt;/span&gt;&lt;/div&gt;</html></example><example><desc>Returns the index for the element with ID foo within another element.</desc><code>$(&quot;*&quot;).index( $('#foo')[0] )</code><html>&lt;div id=&quot;foobar&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;span id=&quot;foo&quot;&gt;&lt;/span&gt;&lt;/div&gt;</html></example><example><desc>Returns the index for the element clicked within a collection.</desc><code>var mainNavLinks = $('ul#mainNav li a');
mainNavLinks.click(function(){alert(mainNavLinks.index(this)0;});</code></example><example><desc>Returns -1, as there is no element with ID bar.</desc><code>$(&quot;*&quot;).index( $('#bar')[0] )</code><html>&lt;div id=&quot;foobar&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;span id=&quot;foo&quot;&gt;&lt;/span&gt;&lt;/div&gt;</html></example></function></subcat><subcat value="Data Cache"><function cat="Core" name="data" return="Any" timestamp="2008-05-08T01:38:40Z"><added>1.2.3</added><desc>Returns value at named data store for the element, as set by data(name, value).</desc><longdesc>&lt;p&gt;If the JQuery collection references multiple elements, the value returned refers to the first element.&lt;/p&gt;&lt;p&gt;This function is used to get stored data on an element without the risk of a circular reference.  It uses jQuery.data and is new to version 1.2.3.  It can be used for many reasons and jQuery UI uses it heavily. &lt;/p&gt;</longdesc><params name="name" type="String"><desc>Name of the data stored.</desc></params><example><desc>Get the data named &quot;blah&quot; stored at for an element.</desc><code>
    $(&quot;button&quot;).click(function(e) {
      var value;

      switch ($(&quot;button&quot;).index(this)) {
        case 0 :
          value = $(&quot;div&quot;).data(&quot;blah&quot;);
          break;
        case 1 :
          $(&quot;div&quot;).data(&quot;blah&quot;, &quot;hello&quot;);
          value = &quot;Stored!&quot;;
          break;
        case 2 :
          $(&quot;div&quot;).data(&quot;blah&quot;, 86);
          value = &quot;Stored!&quot;;
          break;
        case 3 :
          $(&quot;div&quot;).removeData(&quot;blah&quot;);
          value = &quot;Removed!&quot;;
          break;
      }

      $(&quot;span&quot;).text(&quot;&quot; + value);
    });
</code><css>
  div { margin:5px; background:yellow; }
  button { margin:5px; font-size:14px; }
  p { margin:5px; color:blue; }
  span { color:red; }
  </css><html>&lt;div&gt;A div&lt;/div&gt;
  &lt;button&gt;Get &quot;blah&quot; from the div&lt;/button&gt;
  &lt;button&gt;Set &quot;blah&quot; to &quot;hello&quot;&lt;/button&gt;
  &lt;button&gt;Set &quot;blah&quot; to 86&lt;/button&gt;
  &lt;button&gt;Remove &quot;blah&quot; from the div&lt;/button&gt;
  &lt;p&gt;The &quot;blah&quot; value of this div is &lt;span&gt;?&lt;/span&gt;&lt;/p&gt;</html></example></function><function cat="Core" name="data" return="Any" timestamp="2008-05-08T01:38:40Z"><added>1.2.3</added><desc>Stores the value in the named spot and also returns the value.</desc><longdesc>&lt;p&gt;If the JQuery collection references multiple elements, the data element is set on all of them.&lt;/p&gt;&lt;p&gt;This function can be useful for attaching data to elements without having to create a new expando.  It also isn't limited to a string.  The value can be any format.&lt;/p&gt;</longdesc><params name="name" type="String"><desc>Name of the data to store.</desc></params><params name="value" type="Any"><desc>Value to be stored.</desc></params><example><desc>Store then retrieve a value from the div element.</desc><code>
    $(&quot;div&quot;).data(&quot;test&quot;, { first: 16, last: &quot;pizza!&quot; });
    $(&quot;span:first&quot;).text($(&quot;div&quot;).data(&quot;test&quot;).first);
    $(&quot;span:last&quot;).text($(&quot;div&quot;).data(&quot;test&quot;).last);
</code><css>
  div { color:blue; }
  span { color:red; }
  </css><html>&lt;div&gt;
    The values stored were 
    &lt;span&gt;&lt;/span&gt;
    and
    &lt;span&gt;&lt;/span&gt;
  &lt;/div&gt;</html></example></function><function cat="Core" name="removeData" return="jQuery" timestamp="2008-03-15T02:19:27Z"><added>1.2.3</added><desc>Removes named data store from an element.</desc><longdesc>This is the complement function to $(...).data(name, value).</longdesc><params name="name" type="String"><desc>The name of the data store property to remove.</desc></params><example><desc>Set a data store for 2 names then remove one of them.</desc><code>
    $(&quot;span:eq(0)&quot;).text(&quot;&quot; + $(&quot;div&quot;).data(&quot;test1&quot;));
    $(&quot;div&quot;).data(&quot;test1&quot;, &quot;VALUE-1&quot;);
    $(&quot;div&quot;).data(&quot;test2&quot;, &quot;VALUE-2&quot;);
    $(&quot;span:eq(1)&quot;).text(&quot;&quot; + $(&quot;div&quot;).data(&quot;test1&quot;));
    $(&quot;div&quot;).removeData(&quot;test1&quot;);
    $(&quot;span:eq(2)&quot;).text(&quot;&quot; + $(&quot;div&quot;).data(&quot;test1&quot;));
    $(&quot;span:eq(3)&quot;).text(&quot;&quot; + $(&quot;div&quot;).data(&quot;test2&quot;));
</code><css>
  div { margin:2px; color:blue; }
  span { color:red; }
  </css><html>&lt;div&gt;value1 before creation: &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;value1 after creation: &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;value1 after removal: &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;value2 after removal: &lt;span&gt;&lt;/span&gt;&lt;/div&gt;</html></example></function></subcat><subcat value="Plugins"><function cat="Core" name="jQuery.fn.extend" return="jQuery" timestamp="2007-10-12T05:47:51Z"><added>1.0</added><desc>Extends the jQuery element set to provide new methods (used to make a typical jQuery plugin).</desc><longdesc>Can be used to add functions into the to add <![CDATA[<a href='Plugins/Authoring'>plugin methods (plugins)</a>]]>. </longdesc><params name="object" type="Object"><desc>The object that will be merged into the jQuery object.</desc></params><example><desc>Adds two plugin methods.</desc><code>jQuery.fn.extend({
  check: function() {
    return this.each(function() { this.checked = true; });
  },
  uncheck: function() {
    return this.each(function() { this.checked = false; });
  }
});</code><results>$(&quot;input[@type=checkbox]&quot;).check();
$(&quot;input[@type=radio]&quot;).uncheck();</results></example></function><function cat="Core" name="jQuery.extend" return="jQuery" timestamp="2007-10-12T05:46:58Z"><added>1.0</added><desc>Extends the jQuery object itself.</desc><longdesc>Can be used to add functions into the jQuery namespace. See <![CDATA[<a href='Core/jQuery.fn.extend'>jQuery.fn.extend</a>]]> for more information on using this method to add <![CDATA[<a href='Plugins/Authoring'>Plugins</a>]]>.</longdesc><params name="object" type="Object"><desc>The object that will be merged into the jQuery object.</desc></params><example><desc>Adds two functions into the jQuery namespace.</desc><code>jQuery.extend({
  min: function(a, b) { return a &lt; b ? a : b; },
  max: function(a, b) { return a &gt; b ? a : b; }
});</code><results>jQuery.min(2,3); // =&gt; 2
jQuery.max(4,5); // =&gt; 5</results></example></function></subcat><subcat value="Interoperability"><function cat="Core" name="jQuery.noConflict" return="jQuery" timestamp="2008-05-25T03:06:30Z"><added>1.0</added><desc>Run this function to give control of the $ variable back to whichever library first implemented it.</desc><longdesc>This helps to make sure that jQuery doesn't conflict with the $ object of other libraries.

By using this function, you will only be able to access jQuery using the 'jQuery' variable. For example, where you used to do $(&quot;div p&quot;), you now must do jQuery(&quot;div p&quot;).

'''NOTE:''' This function must be called after including the jQuery javascript file, but '''before''' including any other conflicting library, and also before actually that other conflicting library gets used, in case jQuery is included last.</longdesc><example><desc>Maps the original object that was referenced by $ back to $.</desc><code>jQuery.noConflict();
// Do something with jQuery
jQuery(&quot;div p&quot;).hide();
// Do something with another library's $()
$(&quot;content&quot;).style.display = 'none';</code></example><example><desc>Reverts the $ alias and then creates and executes a function to provide the $ as a jQuery alias inside the functions scope. Inside the function the original $ object is not available. This works well for most plugins that don't rely on any other library.</desc><code>jQuery.noConflict();
(function($) { 
  $(function() {
    // more code using $ as alias to jQuery
  });
})(jQuery);
// other code using $ as an alias to the other library</code></example><example><desc>Creates a different alias instead of jQuery to use in the rest of the script.</desc><code>var j = jQuery.noConflict();
// Do something with jQuery
j(&quot;div p&quot;).hide();
// Do something with another library's $()
$(&quot;content&quot;).style.display = 'none';</code></example></function><function cat="Core" name="jQuery.noConflict" return="jQuery" timestamp="2008-05-25T03:06:30Z"><added>1.1.4</added><desc>Revert control of both the $ and jQuery variables to their original owners. '''Use with discretion.'''</desc><longdesc>This is a more-extreme version of the simple <![CDATA[<a href='Core/jQuery.noConflict'>noConflict</a>]]> method, as this one will completely undo what jQuery has introduced. This is to be used in an extreme case where you'd like to embed jQuery into a high-conflict environment. '''NOTE:''' It's very likely that plugins won't work after this particular method has been called.</longdesc><params name="extreme" type="Boolean"><desc>Set to true to enable the extreme rollback of jQuery and it's variables.</desc></params><example><desc>Completely move jQuery to a new namespace in another object.</desc><code>var dom = {};
dom.query = jQuery.noConflict(true);</code><results>// Do something with the new jQuery
dom.query(&quot;div p&quot;).hide();
// Do something with another library's $()
$(&quot;content&quot;).style.display = 'none';
// Do something with another version of jQuery
jQuery(&quot;div &gt; p&quot;).hide();</results></example></function></subcat></cat><cat value="Selectors"><subcat value="Basics"><selector cat="Selectors" name="id" return="Array&lt;Element&gt;" timestamp="2008-04-12T10:45:53Z"><sample>#id</sample><added>1.0</added><desc>Matches a single element with the given id attribute. </desc><longdesc>If the id contains characters like periods or colons you have to escape those characters with backslashes [http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F].</longdesc><params name="id" type="String"><desc>An ID to search for, specified via the id attribute of an element.</desc></params><example><desc>Finds the element with the id &quot;myDiv&quot;.</desc><code>$(&quot;#myDiv&quot;).css(&quot;border&quot;,&quot;3px solid red&quot;);</code><html>&lt;div id=&quot;notMe&quot;&gt;&lt;p&gt;id=&quot;notMe&quot;&lt;/p&gt;&lt;/div&gt;
  &lt;div id=&quot;myDiv&quot;&gt;id=&quot;myDiv&quot;&lt;/div&gt;</html><css>
  div {
    width: 90px;
    height: 90px;
    float:left;
    padding: 5px;
    margin: 5px;
    background-color: #EEEEEE;
  }
  </css></example><example><desc>Finds the element with the id &quot;myID.entry[1]&quot;.  See how certain characters must be escaped with backslashes.</desc><code>$(&quot;#myID\\.entry\\[1\\]&quot;).css(&quot;border&quot;,&quot;3px solid red&quot;);</code><html>&lt;div id=&quot;myID.entry[0]&quot;&gt;id=&quot;myID.entry[0]&quot;&lt;/div&gt;
  &lt;div id=&quot;myID.entry[1]&quot;&gt;id=&quot;myID.entry[1]&quot;&lt;/div&gt;
  &lt;div id=&quot;myID.entry[2]&quot;&gt;id=&quot;myID.entry[2]&quot;&lt;/div&gt;</html><css>
  div {
    width: 300px;
    float:left;
    padding: 2px;
    margin: 3px;
    background-color: #EEEEEE;
  }
  </css></example></selector><selector cat="Selectors" name="element" return="Array&lt;Element(s)&gt;" timestamp="2008-05-25T22:30:44Z"><sample>element</sample><added>1.0</added><desc>Matches all elements with the given name. </desc><longdesc></longdesc><params name="element" type="String"><desc>An element to search for. Refers to the tagName of DOM nodes.</desc></params><example><desc>Finds every DIV element.</desc><code>$(&quot;div&quot;).css(&quot;border&quot;,&quot;3px solid red&quot;);</code><html>&lt;div&gt;DIV1&lt;/div&gt;
  &lt;div&gt;DIV2&lt;/div&gt;
  &lt;span&gt;SPAN&lt;/span&gt;</html><css>
  div,span {
    width: 60px;
    height: 60px;
    float:left;
    padding: 10px;
    margin: 10px;
    background-color: #EEEEEE;
  }
  </css></example></selector><selector cat="Selectors" name="class" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:43:39Z"><sample>.class</sample><added>1.0</added><desc>Matches all elements with the given class. </desc><longdesc></longdesc><params name="class" type="String"><desc>A class to search for. An element can have multiple classes, one of them must match.</desc></params><example><desc>Finds the element with the class &quot;myClass&quot;.</desc><code>$(&quot;.myClass&quot;).css(&quot;border&quot;,&quot;3px solid red&quot;);</code><html>&lt;div class=&quot;notMe&quot;&gt;div class=&quot;notMe&quot;&lt;/div&gt;
  &lt;div class=&quot;myClass&quot;&gt;div class=&quot;myClass&quot;&lt;/div&gt;
  &lt;span class=&quot;myClass&quot;&gt;span class=&quot;myClass&quot;&lt;/span&gt;</html><css>
  div,span {
    width: 150px;
    height: 60px;
    float:left;
    padding: 10px;
    margin: 10px;
    background-color: #EEEEEE;
  }
  </css></example></selector><selector cat="Selectors" name="all" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:44:19Z"><sample>*</sample><added>1.0</added><desc>Matches all elements.</desc><longdesc>Most useful when combined with a context to search in.</longdesc><example><desc>Finds every element (including head, body, etc).</desc><code>$(&quot;*&quot;).css(&quot;border&quot;,&quot;3px solid red&quot;);</code><html>&lt;div&gt;DIV&lt;/div&gt;
  &lt;span&gt;SPAN&lt;/span&gt;
  &lt;p&gt;P &lt;button&gt;Button&lt;/button&gt;&lt;/p&gt;</html><css>
  div,span,p {
    width: 150px;
    height: 60px;
    float:left;
    padding: 10px;
    margin: 10px;
    background-color: #EEEEEE;
  }
  </css></example><example><desc>A common way to find all elements is to set the 'context' to document.body so elements like head, script, etc are left out.</desc><code>$(&quot;*&quot;, document.body).css(&quot;border&quot;,&quot;3px solid red&quot;);</code></example></selector><selector cat="Selectors" name="multiple" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:44:47Z"><sample>selector1, selector2, selectorN</sample><added>1.0</added><desc>Matches the combined results of all the specified selectors.</desc><longdesc>You can specify any number of selectors to combine into a single result.  Note order of the dom elements in the jQuery object aren't necessarily identical.</longdesc><params name="selector1" type="Selector"><desc>Any valid selector</desc></params><params name="selector2" type="Selector"><desc>Another valid selector</desc></params><params name="selectorN" optional="true" type="Selector"><desc>As many more valid selectors as you like</desc></params><example><desc>Finds the elements that match any of these three selectors.</desc><code>$(&quot;div,span,p.myClass&quot;).css(&quot;border&quot;,&quot;3px solid red&quot;);</code><html>&lt;div&gt;div&lt;/div&gt;
  &lt;p class=&quot;myClass&quot;&gt;p class=&quot;myClass&quot;&lt;/p&gt;
  &lt;p class=&quot;notMyClass&quot;&gt;p class=&quot;notMyClass&quot;&lt;/p&gt;
  &lt;span&gt;span&lt;/span&gt;</html><css>
  div,span,p {
    width: 130px;
    height: 60px;
    float:left;
    padding: 3px;
    margin: 2px;
    background-color: #EEEEEE;
    font-size:14px;
  }
  </css></example><example><desc>Show the order in the jQuery object.</desc><code>
    var list = $(&quot;div,p,span&quot;).map(function () {
      return this.tagName;
    }).get().join(&quot;, &quot;);
    $(&quot;b&quot;).append(document.createTextNode(list));
</code><css>
  b { color:red; font-size:16px; display:block; clear:left; }
  div,span,p { width: 40px; height: 40px; float:left;
               margin: 10px; background-color: blue; 
               padding:3px; color:white; }
  </css><html>&lt;span&gt;span&lt;/span&gt;
  &lt;p&gt;p&lt;/p&gt;
  &lt;p&gt;p&lt;/p&gt;
  &lt;div&gt;div&lt;/div&gt;
  &lt;span&gt;span&lt;/span&gt;
  &lt;p&gt;p&lt;/p&gt;
  &lt;div&gt;div&lt;/div&gt;
  &lt;b&gt;&lt;/b&gt;</html></example></selector></subcat><subcat value="Hierarchy"><selector cat="Selectors" name="descendant" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:45:22Z"><sample>ancestor descendant</sample><added>1.0</added><desc>Matches all descendant elements specified by &quot;descendant&quot; of elements specified by &quot;ancestor&quot;.</desc><longdesc></longdesc><params name="ancestor" type="Selector"><desc>Any valid selector.</desc></params><params name="descendant" type="Selector"><desc>A selector to match elements that are descendants of the first selector.</desc></params><example><desc>Finds all input descendants of forms.</desc><code>$(&quot;form input&quot;).css(&quot;border&quot;, &quot;2px dotted blue&quot;);</code><css>
  body { font-size:14px; }
  form { border:2px green solid; padding:2px; margin:0; 
         background:#efe; }
  div { color:red; }
  fieldset { margin:1px; padding:3px; }
  </css><html>&lt;form&gt;
    &lt;div&gt;Form is surrounded by the green outline&lt;/div&gt;
    &lt;label&gt;Child:&lt;/label&gt;
    &lt;input name=&quot;name&quot; /&gt;
    &lt;fieldset&gt;
      &lt;label&gt;Grandchild:&lt;/label&gt;
      &lt;input name=&quot;newsletter&quot; /&gt;
    &lt;/fieldset&gt;
  &lt;/form&gt;
  Sibling to form: &lt;input name=&quot;none&quot; /&gt;</html></example></selector><selector cat="Selectors" name="child" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:46:31Z"><sample>parent &gt; child</sample><added>1.0</added><desc>Matches all child elements specified by &quot;child&quot; of elements specified by &quot;parent&quot;.</desc><longdesc></longdesc><params name="parent" type="Selector"><desc>Any valid selector.</desc></params><params name="child" type="Selector"><desc>A selector to match elements that are children of the first selector.</desc></params><example><desc>Finds all children of the element with id &quot;main&quot; which is yellow.</desc><code>$(&quot;#main &gt; *&quot;).css(&quot;border&quot;, &quot;3px double red&quot;);</code><css>
  body { font-size:14px; }
  span#main { display:block; background:yellow; height:110px; }
  button { display:block; float:left; margin:2px; 
           font-size:14px; }
  div { width:90px; height:90px; margin:5px; float:left;
        background:#bbf; font-weight:bold; }
  div.mini { width:30px; height:30px; background:green; }
  </css><html>&lt;span id=&quot;main&quot;&gt;
    &lt;div&gt;&lt;/div&gt;
    &lt;button&gt;Child&lt;/button&gt;
    &lt;div class=&quot;mini&quot;&gt;&lt;/div&gt;
    &lt;div&gt;
      &lt;div class=&quot;mini&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;mini&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div&gt;&lt;button&gt;Grand&lt;/button&gt;&lt;/div&gt;
    &lt;div&gt;&lt;span&gt;A Span &lt;em&gt;in&lt;/em&gt; child&lt;/span&gt;&lt;/div&gt;
    &lt;span&gt;A Span in main&lt;/span&gt;
  &lt;/span&gt;</html></example></selector><selector cat="Selectors" name="next" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:47:01Z"><sample>prev + next</sample><added>1.0</added><desc>Matches all next elements specified by &quot;next&quot; that are next to elements specified by &quot;prev&quot;.</desc><longdesc></longdesc><params name="prev" type="Selector"><desc>Any valid selector.</desc></params><params name="next" type="Selector"><desc>A selector to match elements that are next to the first selector.</desc></params><example><desc>Finds all inputs that are next to a label.</desc><code>$(&quot;label + input&quot;).css(&quot;color&quot;, &quot;blue&quot;).val(&quot;Labeled!&quot;)</code><html>&lt;form&gt;
    &lt;label&gt;Name:&lt;/label&gt;
    &lt;input name=&quot;name&quot; /&gt;
    &lt;fieldset&gt;
      &lt;label&gt;Newsletter:&lt;/label&gt;
      &lt;input name=&quot;newsletter&quot; /&gt;
    &lt;/fieldset&gt;
  &lt;/form&gt;
  &lt;input name=&quot;none&quot; /&gt;</html></example></selector><selector cat="Selectors" name="siblings" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:47:41Z"><sample>prev ~ siblings</sample><added>1.0</added><desc>Matches all sibling elements after the &quot;prev&quot; element that match the filtering &quot;siblings&quot; selector.</desc><longdesc></longdesc><params name="prev" type="Selector"><desc>Any valid selector.</desc></params><params name="siblings" type="Selector"><desc>A filter selector to match elements that are following siblings to the first selector.</desc></params><example><desc>Finds all divs that are siblings after the element with #prev as its id.  Notice the span isn't selected since it is not a div and the &quot;niece&quot; isn't selected since it is a child of a sibling, not an actual sibling.</desc><code>$(&quot;#prev ~ div&quot;).css(&quot;border&quot;, &quot;3px groove blue&quot;);</code><css>
  div,span {
    display:block;
    width:80px;
    height:80px;
    margin:5px;
    background:#bbffaa;
    float:left;
    font-size:14px;
  }
  div#small {
    width:60px;
    height:25px;
    font-size:12px;
    background:#fab;
  }
  </css><html>&lt;div&gt;div (doesn't match since before #prev)&lt;/div&gt;
  &lt;div id=&quot;prev&quot;&gt;div#prev&lt;/div&gt;
  &lt;div&gt;div sibling&lt;/div&gt;
  &lt;div&gt;div sibling &lt;div id=&quot;small&quot;&gt;div neice&lt;/div&gt;&lt;/div&gt;
  &lt;span&gt;span sibling (not div)&lt;/span&gt;
  &lt;div&gt;div sibling&lt;/div&gt;</html></example></selector></subcat><subcat value="Basic Filters"><selector cat="Selectors" name="first" return="Array&lt;Element&gt;" timestamp="2008-05-10T19:24:23Z"><sample>:first</sample><added>1.0</added><desc>Matches the first selected element.</desc><longdesc>While this matches only a single element, <![CDATA[<a href='Selectors/firstChild'>:first-child</a>]]> matches more than one: One for each parent.</longdesc><example><desc>Finds the first table row.</desc><code>$(&quot;tr:first&quot;).css(&quot;font-style&quot;, &quot;italic&quot;);</code><css>
  td { color:blue; font-weight:bold; }
  </css><html>&lt;table&gt;
    &lt;tr&gt;&lt;td&gt;Row 1&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Row 2&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Row 3&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;</html></example></selector><selector cat="Selectors" name="last" return="Array&lt;Element&gt;" timestamp="2008-04-12T10:49:46Z"><sample>:last</sample><added>1.0</added><desc>Matches the last selected element.</desc><longdesc></longdesc><example><desc>Finds the last table row.</desc><code>$(&quot;tr:last&quot;).css({backgroundColor: 'yellow', fontWeight: 'bolder'});</code><html>&lt;table&gt;
    &lt;tr&gt;&lt;td&gt;First Row&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Middle Row&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Last Row&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;</html></example></selector><selector cat="Selectors" name="not" return="Array&lt;Element(s)&gt;" timestamp="2008-05-22T15:26:25Z"><sample>:not(selector)</sample><added>1.1.4</added><desc>Filters out all elements matching the given selector.</desc><longdesc></longdesc><params name="selector" type="Selector"><desc>A selector with which to filter by.</desc></params><example><desc>Finds all inputs that are not checked and highlights the next sibling span.  Notice there is no change when clicking the checkboxes since no click events have been linked.</desc><code>
    $(&quot;input:not(:checked) + span&quot;).css(&quot;background-color&quot;, &quot;yellow&quot;);
    $(&quot;input&quot;).attr(&quot;disabled&quot;, &quot;disabled&quot;);
</code><html>&lt;div&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;a&quot; /&gt;
    &lt;span&gt;Mary&lt;/span&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;b&quot; /&gt;
    &lt;span&gt;lcm&lt;/span&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;c&quot; checked=&quot;checked&quot; /&gt;
    &lt;span&gt;Peter&lt;/span&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="even" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:50:56Z"><sample>:even</sample><added>1.0</added><desc>Matches even elements, zero-indexed.</desc><longdesc></longdesc><example><desc>Finds even table rows, matching the first, third and so on (index 0, 2, 4 etc.).</desc><code>$(&quot;tr:even&quot;).css(&quot;background-color&quot;, &quot;#bbbbff&quot;);</code><css>
  table {
    background:#eeeeee;
  }
  </css><html>&lt;table border=&quot;1&quot;&gt;
    &lt;tr&gt;&lt;td&gt;Row with Index #0&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Row with Index #1&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Row with Index #2&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Row with Index #3&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;</html></example></selector><selector cat="Selectors" name="odd" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:51:33Z"><sample>:odd</sample><added>1.0</added><desc>Matches odd elements, zero-indexed.</desc><longdesc></longdesc><example><desc>Finds odd table rows, matching the second, fourth and so on (index 1, 3, 5 etc.).</desc><code>$(&quot;tr:odd&quot;).css(&quot;background-color&quot;, &quot;#bbbbff&quot;);</code><css>
  table {
    background:#f3f7f5;
  }
  </css><html>&lt;table border=&quot;1&quot;&gt;
    &lt;tr&gt;&lt;td&gt;Row with Index #0&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Row with Index #1&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Row with Index #2&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Row with Index #3&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;</html></example></selector><selector cat="Selectors" name="eq" return="Array&lt;Element&gt;" timestamp="2008-04-15T22:47:38Z"><sample>:eq(index)</sample><added>1.0</added><desc>Matches a single element by its index.</desc><longdesc></longdesc><params name="index" type="Number"><desc>Zero-based index of the element to match.</desc></params><example><desc>Finds the third td.</desc><code>$(&quot;td:eq(2)&quot;).css(&quot;color&quot;, &quot;red&quot;);</code><html>&lt;table border=&quot;1&quot;&gt;
    &lt;tr&gt;&lt;td&gt;TD #0&lt;/td&gt;&lt;td&gt;TD #1&lt;/td&gt;&lt;td&gt;TD #2&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;TD #3&lt;/td&gt;&lt;td&gt;TD #4&lt;/td&gt;&lt;td&gt;TD #5&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;TD #6&lt;/td&gt;&lt;td&gt;TD #7&lt;/td&gt;&lt;td&gt;TD #8&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;</html></example></selector><selector cat="Selectors" name="gt" return="Array&lt;Element(s)&gt;" timestamp="2008-04-15T22:48:14Z"><sample>:gt(index)</sample><added>1.0</added><desc>Matches all elements with an index above the given one.</desc><longdesc></longdesc><params name="index" type="Number"><desc>Zero-based index.</desc></params><example><desc>Finds TD #5 and higher. Reminder: the indexing starts at 0.</desc><code>$(&quot;td:gt(4)&quot;).css(&quot;text-decoration&quot;, &quot;line-through&quot;);</code><html>&lt;table border=&quot;1&quot;&gt;
    &lt;tr&gt;&lt;td&gt;TD #0&lt;/td&gt;&lt;td&gt;TD #1&lt;/td&gt;&lt;td&gt;TD #2&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;TD #3&lt;/td&gt;&lt;td&gt;TD #4&lt;/td&gt;&lt;td&gt;TD #5&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;TD #6&lt;/td&gt;&lt;td&gt;TD #7&lt;/td&gt;&lt;td&gt;TD #8&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;</html></example></selector><selector cat="Selectors" name="lt" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:53:26Z"><sample>:lt(index)</sample><added>1.0</added><desc>Matches all elements with an index below the given one.</desc><longdesc></longdesc><params name="index" type="Number"><desc>Zero-based index.</desc></params><example><desc>Finds TDs less than the one with the 4th index (TD#4).</desc><code>$(&quot;td:lt(4)&quot;).css(&quot;color&quot;, &quot;red&quot;);</code><html>&lt;table border=&quot;1&quot;&gt;
    &lt;tr&gt;&lt;td&gt;TD #0&lt;/td&gt;&lt;td&gt;TD #1&lt;/td&gt;&lt;td&gt;TD #2&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;TD #3&lt;/td&gt;&lt;td&gt;TD #4&lt;/td&gt;&lt;td&gt;TD #5&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;TD #6&lt;/td&gt;&lt;td&gt;TD #7&lt;/td&gt;&lt;td&gt;TD #8&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;</html></example></selector><selector cat="Selectors" name="header" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:53:37Z"><sample>:header</sample><added>1.2</added><desc>Matches all elements that are headers, like h1, h2, h3 and so on.</desc><longdesc></longdesc><example><desc>Adds a background and text color to all the headers on the page.</desc><code>$(&quot;:header&quot;).css({ background:'#CCC', color:'blue' });</code><html>&lt;h1&gt;Header 1&lt;/h1&gt;
  &lt;p&gt;Contents 1&lt;/p&gt;
  &lt;h2&gt;Header 2&lt;/h2&gt;
  &lt;p&gt;Contents 2&lt;/p&gt;</html><css>
  body { font-size: 10px; font-family: Arial; } 
  h1, h2 { margin: 3px 0; }
  </css></example></selector><selector cat="Selectors" name="animated" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:53:52Z"><sample>:animated</sample><added>1.2</added><desc>Matches all elements that are currently being animated.</desc><longdesc></longdesc><example><desc>Change the color of any div that is animated.</desc><code>
    $(&quot;#run&quot;).click(function(){
      $(&quot;div:animated&quot;).toggleClass(&quot;colored&quot;);
    });
    function animateIt() {
      $(&quot;#mover&quot;).slideToggle(&quot;slow&quot;, animateIt);
    }
    animateIt();
</code><html>&lt;button id=&quot;run&quot;&gt;Run&lt;/button&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div id=&quot;mover&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html><css>
  div { background:yellow; border:1px solid #AAA; width:80px; height:80px; margin:5px; float:left; }
  div.colored { background:green; }
  </css></example></selector></subcat><subcat value="Content Filters"><selector cat="Selectors" name="contains" return="Array&lt;Element(s)&gt;" timestamp="2008-04-15T22:49:43Z"><sample>:contains(text)</sample><added>1.1.4</added><desc>Matches elements which contain the given text.</desc><longdesc></longdesc><params name="text" type="String"><desc>A string of text to look for. It's case sensitive.</desc></params><example><desc>Finds all divs containing &quot;John&quot; and underlines them.</desc><code>$(&quot;div:contains('John')&quot;).css(&quot;text-decoration&quot;, &quot;underline&quot;);</code><html>&lt;div&gt;John Resig&lt;/div&gt;
  &lt;div&gt;George Martin&lt;/div&gt;
  &lt;div&gt;Malcom John Sinclair&lt;/div&gt;
  &lt;div&gt;J. Ohn</html></example></selector><selector cat="Selectors" name="empty" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:56:28Z"><sample>:empty</sample><added>1.0</added><desc>Matches all elements that have no children (including text nodes).</desc><longdesc></longdesc><example><desc>Finds all elements that are empty - they don't have child elements or text.</desc><code>$(&quot;td:empty&quot;).text(&quot;Was empty!&quot;).css('background', 'rgb(255,220,200)');</code><css>
  td { text-align:center; }
  </css><html>&lt;table border=&quot;1&quot;&gt;
    &lt;tr&gt;&lt;td&gt;TD #0&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;TD #2&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;TD#5&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;</html></example></selector><selector cat="Selectors" name="has" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:57:09Z"><sample>:has(selector)</sample><added>1.1.4</added><desc>Matches elements which contain at least one element that matches the specified selector.</desc><longdesc></longdesc><params name="selector" type="Selector"><desc>A selector with which to filter by.</desc></params><example><desc>Adds the class &quot;test&quot; to all divs that have a paragraph inside of them.</desc><code>$(&quot;div:has(p)&quot;).addClass(&quot;test&quot;);</code><html>&lt;div&gt;&lt;p&gt;Hello in a paragraph&lt;/p&gt;&lt;/div&gt;
  &lt;div&gt;Hello again! (with no paragraph)&lt;/div&gt;</html><css>
  .test{ border: 3px inset red; }
  </css></example></selector><selector cat="Selectors" name="parent" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:58:06Z"><sample>:parent</sample><added>1.0</added><desc>Matches all elements that are parents - they have child elements, including text.</desc><longdesc></longdesc><example><desc>Finds all tds with children, including text.</desc><code>$(&quot;td:parent&quot;).fadeTo(1500, 0.3);</code><css>
td { width:40px; background:green; }
  </css><html>&lt;table border=&quot;1&quot;&gt;
    &lt;tr&gt;&lt;td&gt;Value 1&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Value 2&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;</html></example></selector></subcat><subcat value="Visibility Filters"><selector cat="Selectors" name="hidden" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:58:18Z"><sample>:hidden</sample><added>1.0</added><desc>Matches all elements that are hidden, or input elements of type &quot;hidden&quot;.</desc><longdesc></longdesc><example><desc>Shows all hidden divs and counts hidden inputs.</desc><code>
    // in some browsers :hidden includes head, title, script, etc... so limit to body
    $(&quot;span:first&quot;).text(&quot;Found &quot; + $(&quot;:hidden&quot;, document.body).length + 
                         &quot; hidden elements total.&quot;);
    $(&quot;div:hidden&quot;).show(3000);
    $(&quot;span:last&quot;).text(&quot;Found &quot; + $(&quot;input:hidden&quot;).length + &quot; hidden inputs.&quot;);
</code><css>
  div { width:70px; height:40px; background:#ee77ff; margin:5px; float:left; }
  span { display:block; clear:left; color:red; }
  .starthidden { display:none; }
  </css><html>&lt;span&gt;&lt;/span&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div style=&quot;display:none;&quot;&gt;Hider!&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div class=&quot;starthidden&quot;&gt;Hider!&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;form&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
  &lt;/form&gt;
  &lt;span&gt;
  &lt;/span&gt;</html></example></selector><selector cat="Selectors" name="visible" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:58:29Z"><sample>:visible</sample><added>1.0</added><desc>Matches all elements that are visible.</desc><longdesc></longdesc><example><desc>Make all visible divs turn yellow on click.</desc><code>
    $(&quot;div:visible&quot;).click(function () {
      $(this).css(&quot;background&quot;, &quot;yellow&quot;);
    });
    $(&quot;button&quot;).click(function () {
      $(&quot;div:hidden&quot;).show(&quot;fast&quot;);
    });
</code><css>
  div { width:50px; height:40px; margin:5px; border:3px outset green; float:left; }
  .starthidden { display:none; }
  </css><html>&lt;button&gt;Show hidden to see they don't change&lt;/button&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div class=&quot;starthidden&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div style=&quot;display:none;&quot;&gt;&lt;/div&gt;</html></example></selector></subcat><subcat value="Attribute Filters"><selector cat="Selectors" name="attributeHas" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:58:41Z"><sample>[attribute]</sample><added>1.0</added><desc>Matches elements that have the specified attribute.</desc><longdesc></longdesc><params name="attribute" type="String"><desc>An attribute name.</desc></params><example><desc>Bind a single click that adds the div id to its text.</desc><code>
    $(&quot;div[id]&quot;).one(&quot;click&quot;, function(){
      var idString = $(this).text() + &quot; = &quot; + $(this).attr(&quot;id&quot;);
      $(this).text(idString);
    });
</code><html>&lt;div&gt;no id&lt;/div&gt;
  &lt;div id=&quot;hey&quot;&gt;with id&lt;/div&gt;
  &lt;div id=&quot;there&quot;&gt;has an id&lt;/div&gt;
  &lt;div&gt;nope&lt;/div&gt;</html></example></selector><selector cat="Selectors" name="attributeEquals" return="Array&lt;Element(s)&gt;" timestamp="2008-05-25T09:16:45Z"><sample>[attribute=value]</sample><added>1.0</added><desc>Matches elements that have the specified attribute with a certain value.</desc><longdesc></longdesc><params name="attribute" type="String"><desc>An attribute name.</desc></params><params name="value" type="String"><desc>An attribute value. Quotes are optional in most cases, but should be used to avoid conflicts when the value contains characters like &quot;]&quot;.</desc></params><example><desc>Finds all inputs with name 'newsletter' and changes the text of the span next to it.</desc><code>$(&quot;input[name='newsletter']&quot;).next().text(&quot; is newsletter&quot;);</code><html>&lt;div&gt;
    &lt;input type=&quot;radio&quot; name=&quot;newsletter&quot; value=&quot;Hot Fuzz&quot; /&gt;
    &lt;span&gt;name?&lt;/span&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;input type=&quot;radio&quot; name=&quot;newsletters&quot; value=&quot;Cold Fusion&quot; /&gt;
    &lt;span&gt;name?&lt;/span&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;input type=&quot;radio&quot; name=&quot;accept&quot; value=&quot;Evil Plans&quot; /&gt;
    &lt;span&gt;name?&lt;/span&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="attributeNotEqual" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:59:53Z"><sample>[attribute!=value]</sample><added>1.0</added><desc>Matches elements that don't have the specified attribute with a certain value.</desc><longdesc></longdesc><params name="attribute" type="String"><desc>An attribute name.</desc></params><params name="value" type="String"><desc>An attribute value. Quotes are optional in most cases, but should be used to avoid conflicts when the value contains characters like &quot;]&quot;.</desc></params><example><desc>Finds all inputs that don't have the name 'newsletter' and changes the text of the span next to it.</desc><code>$(&quot;input[name!='newsletter']&quot;).next().text(&quot; is not newsletter&quot;);</code><html>&lt;div&gt;
    &lt;input type=&quot;radio&quot; name=&quot;newsletter&quot; value=&quot;Hot Fuzz&quot; /&gt;
    &lt;span&gt;name?&lt;/span&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;input type=&quot;radio&quot; name=&quot;newsletter&quot; value=&quot;Cold Fusion&quot; /&gt;
    &lt;span&gt;name?&lt;/span&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;input type=&quot;radio&quot; name=&quot;accept&quot; value=&quot;Evil Plans&quot; /&gt;
    &lt;span&gt;name?&lt;/span&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="attributeStartsWith" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:00:07Z"><sample>[attribute^=value]</sample><added>1.0</added><desc>Matches elements that have the specified attribute and it starts with a certain value.</desc><longdesc></longdesc><params name="attribute" type="String"><desc>An attribute name.</desc></params><params name="value" type="String"><desc>An attribute value. Quotes are optional in most cases, but should be used to avoid conflicts when the value contains characters like &quot;]&quot;.</desc></params><example><desc>Finds all inputs with an attribute name that starts with 'news' and puts text in them.</desc><code>$(&quot;input[@name^='news']&quot;).val(&quot;news here!&quot;);</code><html>&lt;input name=&quot;newsletter&quot; /&gt;
  &lt;input name=&quot;milkman&quot; /&gt;
  &lt;input name=&quot;newsboy&quot; /&gt;</html></example></selector><selector cat="Selectors" name="attributeEndsWith" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:00:21Z"><sample>[attribute$=value]</sample><added>1.0</added><desc>Matches elements that have the specified attribute and it ends with a certain value.</desc><longdesc></longdesc><params name="attribute" type="String"><desc>An attribute name.</desc></params><params name="value" type="String"><desc>An attribute value. Quotes are optional in most cases, but should be used to avoid conflicts when the value contains characters like &quot;]&quot;.</desc></params><example><desc>Finds all inputs with an attribute name that ends with 'letter' and puts text in them.</desc><code>$(&quot;input[name$='letter']&quot;).val(&quot;a letter&quot;);</code><html>&lt;input name=&quot;newsletter&quot; /&gt;
  &lt;input name=&quot;milkman&quot; /&gt;
  &lt;input name=&quot;jobletter&quot; /&gt;</html></example></selector><selector cat="Selectors" name="attributeContains" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:00:32Z"><sample>[attribute*=value]</sample><added>1.0</added><desc>Matches elements that have the specified attribute and it contains a certain value.</desc><longdesc></longdesc><params name="attribute" type="String"><desc>An attribute name.</desc></params><params name="value" type="String"><desc>An attribute value. Quotes are optional in most cases, but should be used to avoid conflicts when the value contains characters like &quot;]&quot;.</desc></params><example><desc>Finds all inputs that with a name attribute that contains 'man' and sets the value with some text.</desc><code>$(&quot;input[name*='man']&quot;).val(&quot;has man in it!&quot;);</code><html>&lt;input name=&quot;man-news&quot; /&gt;
  &lt;input name=&quot;milkman&quot; /&gt;
  &lt;input name=&quot;letterman2&quot; /&gt;
  &lt;input name=&quot;newmilk&quot; /&gt;</html></example></selector><selector cat="Selectors" name="attributeMultiple" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:00:51Z"><sample>[selector1][selector2][selectorN]</sample><added>1.0</added><desc>Matches elements that have the specified attribute and it contains a certain value.</desc><longdesc></longdesc><params name="selector1" type="Selector"><desc>An attribute selector.</desc></params><params name="selector2" type="Selector"><desc>Another attribute selector, reducing the selection even more</desc></params><params name="selectorN" optional="true" type="Selector"><desc>As many more attribute selectors as necessary</desc></params><example><desc>Finds all inputs that have an id attribute and whose name attribute ends with man and sets the value.</desc><code>$(&quot;input[id][name$='man']&quot;).val(&quot;only this one&quot;);</code><html>&lt;input id=&quot;man-news&quot; name=&quot;man-news&quot; /&gt;
  &lt;input name=&quot;milkman&quot; /&gt;
  &lt;input id=&quot;letterman&quot; name=&quot;new-letterman&quot; /&gt;
  &lt;input name=&quot;newmilk&quot; /&gt;</html></example></selector></subcat><subcat value="Child Filters"><selector cat="Selectors" name="nthChild" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:03:57Z"><sample>:nth-child(index/even/odd/equation)</sample><added>1.1.4</added><desc>Matches all elements that are the nth-child of their parent or that are the parent's even or odd children.</desc><longdesc>While <![CDATA[<a href='Selectors/eq'>:eq(index)</a>]]> matches only a single element, this matches more then one: One for each parent with index.  Multiple for each parent with even, odd, or equation.

The specified index is one-indexed, in contrast to :eq() which starts at zero.</longdesc><params name="index" type="Number/String"><desc>The index of each child to match, starting with 1 or the string even, odd, or equation ( eg. :nth-child(even), :nth-child(4n) )</desc></params><example><desc>Finds the second li in each matched ul and notes it.</desc><code>$(&quot;ul li:nth-child(2)&quot;).append(&quot;&lt;span&gt; - 2nd!&lt;/span&gt;&quot;);</code><css>
  div { float:left; }
  span { color:blue; }
  </css><html>&lt;div&gt;&lt;ul&gt;
    &lt;li&gt;John&lt;/li&gt;
    &lt;li&gt;Karl&lt;/li&gt;
    &lt;li&gt;Brandon&lt;/li&gt;
  &lt;/ul&gt;&lt;/div&gt;
  &lt;div&gt;&lt;ul&gt;
    &lt;li&gt;Sam&lt;/li&gt;
  &lt;/ul&gt;&lt;/div&gt;
  &lt;div&gt;&lt;ul&gt;
    &lt;li&gt;Glen&lt;/li&gt;
    &lt;li&gt;Tane&lt;/li&gt;
    &lt;li&gt;Ralph&lt;/li&gt;
    &lt;li&gt;David&lt;/li&gt;
  &lt;/ul&gt;&lt;/div&gt;</html></example><example><desc>This is a playground to see how the selector works with different strings.  Notice that this is different from the :even and :odd which have no regard for parent and just filter the list of elements to every other one.  The :nth-child, however, counts the index of the child to its particular parent.  In any case, it's easier to see than explain so...</desc><code>
    $(&quot;button&quot;).click(function () {
      var str = $(this).text();
      $(&quot;tr&quot;).css(&quot;background&quot;, &quot;white&quot;);
      $(&quot;tr&quot; + str).css(&quot;background&quot;, &quot;#ff0000&quot;);
      $(&quot;#inner&quot;).text(str);
    });
</code><css>
  button { display:block; font-size:12px; width:100px; }
  div { float:left; margin:10px; font-size:10px; 
        border:1px solid black; }
  span { color:blue; font-size:18px; }
  #inner { color:red; }
  td { width:50px; text-align:center; }
  </css><html>&lt;div&gt;
    &lt;button&gt;:nth-child(even)&lt;/button&gt;
    &lt;button&gt;:nth-child(odd)&lt;/button&gt;
    &lt;button&gt;:nth-child(3n)&lt;/button&gt;
    &lt;button&gt;:nth-child(2)&lt;/button&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;button&gt;:nth-child(3n+1)&lt;/button&gt;
    &lt;button&gt;:nth-child(3n+2)&lt;/button&gt;
    &lt;button&gt;:even&lt;/button&gt;
    &lt;button&gt;:odd&lt;/button&gt;
  &lt;/div&gt;
  &lt;div&gt;&lt;table&gt;
    &lt;tr&gt;&lt;td&gt;John&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Karl&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Brandon&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Benjamin&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;&lt;/div&gt;
  &lt;div&gt;&lt;table&gt;
    &lt;tr&gt;&lt;td&gt;Sam&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;&lt;/div&gt;
  &lt;div&gt;&lt;table&gt;
    &lt;tr&gt;&lt;td&gt;Glen&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Tane&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Ralph&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;David&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Mike&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;Dan&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;&lt;/div&gt;
  &lt;span&gt;
    tr&lt;span id=&quot;inner&quot;&gt;&lt;/span&gt;
  &lt;/span&gt;</html></example></selector><selector cat="Selectors" name="firstChild" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:02:21Z"><sample>:first-child</sample><added>1.1.4</added><desc>Matches all elements that are the first child of their parent.</desc><longdesc>While <![CDATA[<a href='Selectors/first'>:first</a>]]> matches only a single element, this matches more then one: One for each parent.</longdesc><example><desc>Finds the first span in each matched div to underline and add a hover state.</desc><code>
    $(&quot;div span:first-child&quot;)
        .css(&quot;text-decoration&quot;, &quot;underline&quot;)
        .hover(function () {
              $(this).addClass(&quot;sogreen&quot;);
            }, function () {
              $(this).removeClass(&quot;sogreen&quot;);
            });
</code><css>
  span { color:#008; }
  span.sogreen { color:green; font-weight: bolder; }
  </css><html>&lt;div&gt;
    &lt;span&gt;John,&lt;/span&gt;
    &lt;span&gt;Karl,&lt;/span&gt;
    &lt;span&gt;Brandon&lt;/span&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;span&gt;Glen,&lt;/span&gt;
    &lt;span&gt;Tane,&lt;/span&gt;
    &lt;span&gt;Ralph&lt;/span&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="lastChild" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:04:20Z"><sample>:last-child</sample><added>1.1.4</added><desc>Matches all elements that are the last child of their parent.</desc><longdesc>While <![CDATA[<a href='Selectors/last'>:last</a>]]> matches only a single element, this matches more then one: One for each parent.</longdesc><example><desc>Finds the last span in each matched div and adds some css plus a hover state.</desc><code>
    $(&quot;div span:last-child&quot;)
        .css({color:&quot;red&quot;, fontSize:&quot;80%&quot;})
        .hover(function () {
              $(this).addClass(&quot;solast&quot;);
            }, function () {
              $(this).removeClass(&quot;solast&quot;);
            });
</code><css>
  span.solast { text-decoration:line-through; }
  </css><html>&lt;div&gt;
    &lt;span&gt;John,&lt;/span&gt;
    &lt;span&gt;Karl,&lt;/span&gt;
    &lt;span&gt;Brandon,&lt;/span&gt;
    &lt;span&gt;Sam&lt;/span&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;span&gt;Glen,&lt;/span&gt;
    &lt;span&gt;Tane,&lt;/span&gt;
    &lt;span&gt;Ralph,&lt;/span&gt;
    &lt;span&gt;David&lt;/span&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="onlyChild" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:05:16Z"><sample>:only-child</sample><added>1.1.4</added><desc>Matches all elements that are the only child of their parent.</desc><longdesc>If the parent has other child elements, nothing is matched.</longdesc><example><desc>Finds the button with no siblings in each matched div and modifies look.</desc><code>$(&quot;div button:only-child&quot;).text(&quot;Alone&quot;).css(&quot;border&quot;, &quot;2px blue solid&quot;);</code><css>
  div { width:100px; height:80px; margin:5px; float:left; background:#b9e }
  </css><html>&lt;div&gt;
    &lt;button&gt;Sibling!&lt;/button&gt;
    &lt;button&gt;Sibling!&lt;/button&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;button&gt;Sibling!&lt;/button&gt;
  &lt;/div&gt;
  &lt;div&gt;
    None
  &lt;/div&gt;
  &lt;div&gt;  
    &lt;button&gt;Sibling!&lt;/button&gt;
    &lt;button&gt;Sibling!&lt;/button&gt;
    &lt;button&gt;Sibling!&lt;/button&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;button&gt;Sibling!&lt;/button&gt;
  &lt;/div&gt;</html><results>[ &lt;li&gt;Glen&lt;/li&gt; ]</results></example></selector></subcat><subcat value="Forms"><selector cat="Selectors" name="input" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:06:32Z"><sample>:input</sample><added>1.0</added><desc>Matches all input, textarea, select and button elements.</desc><longdesc></longdesc><example><desc>Finds all input elements.</desc><code>
    var allInputs = $(&quot;:input&quot;);
    var formChildren = $(&quot;form &gt; *&quot;);
    $(&quot;div&quot;).text(&quot;Found &quot; + allInputs.length + &quot; inputs and the form has &quot; +
                             formChildren.length + &quot; children.&quot;)
            .css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;form&quot;).submit(function () { return false; }); // so it won't submit
</code><css>
  textarea { height:45px; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;button&quot; value=&quot;Input Button&quot;/&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;file&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;image&quot; /&gt;
    &lt;input type=&quot;password&quot; /&gt;
    &lt;input type=&quot;radio&quot; /&gt;
    &lt;input type=&quot;reset&quot; /&gt;
    &lt;input type=&quot;submit&quot; /&gt;
    &lt;input type=&quot;text&quot; /&gt;
    &lt;select&gt;&lt;option&gt;Option&lt;/option&gt;&lt;/select&gt;
    &lt;textarea&gt;&lt;/textarea&gt;
    &lt;button&gt;Button&lt;/button&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="text" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:06:45Z"><sample>:text</sample><added>1.0</added><desc>Matches all input elements of type text.</desc><longdesc></longdesc><example><desc>Finds all text inputs.</desc><code>
    var input = $(&quot;:text&quot;).css({background:&quot;yellow&quot;, border:&quot;3px red solid&quot;});
    $(&quot;div&quot;).text(&quot;For this type jQuery found &quot; + input.length + &quot;.&quot;)
            .css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;form&quot;).submit(function () { return false; }); // so it won't submit
</code><css>
  textarea { height:45px; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;button&quot; value=&quot;Input Button&quot;/&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;file&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;image&quot; /&gt;
    &lt;input type=&quot;password&quot; /&gt;
    &lt;input type=&quot;radio&quot; /&gt;
    &lt;input type=&quot;reset&quot; /&gt;
    &lt;input type=&quot;submit&quot; /&gt;
    &lt;input type=&quot;text&quot; /&gt;
    &lt;select&gt;&lt;option&gt;Option&lt;option/&gt;&lt;/select&gt;
    &lt;textarea&gt;&lt;/textarea&gt;
    &lt;button&gt;Button&lt;/button&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="password" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:08:50Z"><sample>:password</sample><added>1.0</added><desc>Matches all input elements of type password.</desc><longdesc></longdesc><example><desc>Finds all password inputs.</desc><code>
    var input = $(&quot;:password&quot;).css({background:&quot;yellow&quot;, border:&quot;3px red solid&quot;});
    $(&quot;div&quot;).text(&quot;For this type jQuery found &quot; + input.length + &quot;.&quot;)
            .css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;form&quot;).submit(function () { return false; }); // so it won't submit
</code><css>
  textarea { height:45px; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;button&quot; value=&quot;Input Button&quot;/&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;file&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;image&quot; /&gt;
    &lt;input type=&quot;password&quot; /&gt;
    &lt;input type=&quot;radio&quot; /&gt;
    &lt;input type=&quot;reset&quot; /&gt;
    &lt;input type=&quot;submit&quot; /&gt;
    &lt;input type=&quot;text&quot; /&gt;
    &lt;select&gt;&lt;option&gt;Option&lt;option/&gt;&lt;/select&gt;
    &lt;textarea&gt;&lt;/textarea&gt;
    &lt;button&gt;Button&lt;/button&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="radio" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:09:01Z"><sample>:radio</sample><added>1.0</added><desc>Matches all input elements of type radio.</desc><longdesc></longdesc><example><desc>Finds all radio inputs.</desc><code>
    var input = $(&quot;:radio&quot;).css({background:&quot;yellow&quot;, border:&quot;3px red solid&quot;});
    $(&quot;div&quot;).text(&quot;For this type jQuery found &quot; + input.length + &quot;.&quot;)
            .css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;form&quot;).submit(function () { return false; }); // so it won't submit
</code><css>
  textarea { height:45px; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;button&quot; value=&quot;Input Button&quot;/&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;file&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;image&quot; /&gt;
    &lt;input type=&quot;password&quot; /&gt;
    &lt;input type=&quot;radio&quot; name=&quot;asdf&quot; /&gt;
    &lt;input type=&quot;radio&quot; name=&quot;asdf&quot; /&gt;
    &lt;input type=&quot;reset&quot; /&gt;
    &lt;input type=&quot;submit&quot; /&gt;
    &lt;input type=&quot;text&quot; /&gt;
    &lt;select&gt;&lt;option&gt;Option&lt;option/&gt;&lt;/select&gt;
    &lt;textarea&gt;&lt;/textarea&gt;
    &lt;button&gt;Button&lt;/button&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="checkbox" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:09:18Z"><sample>:checkbox</sample><added>1.0</added><desc>Matches all input elements of type checkbox.</desc><longdesc></longdesc><example><desc>Finds all checkbox inputs.</desc><code>
    var input = $(&quot;:checkbox&quot;).css({background:&quot;yellow&quot;, border:&quot;3px red solid&quot;});
    $(&quot;div&quot;).text(&quot;For this type jQuery found &quot; + input.length + &quot;.&quot;)
            .css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;form&quot;).submit(function () { return false; }); // so it won't submit
</code><css>
  textarea { height:45px; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;button&quot; value=&quot;Input Button&quot;/&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;file&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;image&quot; /&gt;
    &lt;input type=&quot;password&quot; /&gt;
    &lt;input type=&quot;radio&quot; /&gt;
    &lt;input type=&quot;reset&quot; /&gt;
    &lt;input type=&quot;submit&quot; /&gt;
    &lt;input type=&quot;text&quot; /&gt;
    &lt;select&gt;&lt;option&gt;Option&lt;option/&gt;&lt;/select&gt;
    &lt;textarea&gt;&lt;/textarea&gt;
    &lt;button&gt;Button&lt;/button&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="submit" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:09:34Z"><sample>:submit</sample><added>1.0</added><desc>Matches all input elements of type submit.</desc><longdesc></longdesc><example><desc>Finds all submit inputs.</desc><code>
    var input = $(&quot;:submit&quot;).css({background:&quot;yellow&quot;, border:&quot;3px red solid&quot;});
    $(&quot;div&quot;).text(&quot;For this type jQuery found &quot; + input.length + &quot;.&quot;)
            .css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;form&quot;).submit(function () { return false; }); // so it won't submit
</code><css>
  textarea { height:45px; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;button&quot; value=&quot;Input Button&quot;/&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;file&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;image&quot; /&gt;
    &lt;input type=&quot;password&quot; /&gt;
    &lt;input type=&quot;radio&quot; /&gt;
    &lt;input type=&quot;reset&quot; /&gt;
    &lt;input type=&quot;submit&quot; /&gt;
    &lt;input type=&quot;text&quot; /&gt;
    &lt;select&gt;&lt;option&gt;Option&lt;option/&gt;&lt;/select&gt;
    &lt;textarea&gt;&lt;/textarea&gt;
    &lt;button&gt;Button&lt;/button&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="image" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:10:23Z"><sample>:image</sample><added>1.0</added><desc>Matches all input elements of type image.</desc><longdesc></longdesc><example><desc>Finds all image inputs.</desc><code>
    var input = $(&quot;:image&quot;).css({background:&quot;yellow&quot;, border:&quot;3px red solid&quot;});
    $(&quot;div&quot;).text(&quot;For this type jQuery found &quot; + input.length + &quot;.&quot;)
            .css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;form&quot;).submit(function () { return false; }); // so it won't submit
</code><css>
  textarea { height:45px; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;button&quot; value=&quot;Input Button&quot;/&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;file&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;image&quot; /&gt;
    &lt;input type=&quot;password&quot; /&gt;
    &lt;input type=&quot;radio&quot; /&gt;
    &lt;input type=&quot;reset&quot; /&gt;
    &lt;input type=&quot;submit&quot; /&gt;
    &lt;input type=&quot;text&quot; /&gt;
    &lt;select&gt;&lt;option&gt;Option&lt;option/&gt;&lt;/select&gt;
    &lt;textarea&gt;&lt;/textarea&gt;
    &lt;button&gt;Button&lt;/button&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="reset" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:10:35Z"><sample>:reset</sample><added>1.0</added><desc>Matches all input elements of type reset.</desc><longdesc></longdesc><example><desc>Finds all reset inputs.</desc><code>
    var input = $(&quot;:reset&quot;).css({background:&quot;yellow&quot;, border:&quot;3px red solid&quot;});
    $(&quot;div&quot;).text(&quot;For this type jQuery found &quot; + input.length + &quot;.&quot;)
            .css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;form&quot;).submit(function () { return false; }); // so it won't submit
</code><css>
  textarea { height:45px; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;button&quot; value=&quot;Input Button&quot;/&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;file&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;image&quot; /&gt;
    &lt;input type=&quot;password&quot; /&gt;
    &lt;input type=&quot;radio&quot; /&gt;
    &lt;input type=&quot;reset&quot; /&gt;
    &lt;input type=&quot;submit&quot; /&gt;
    &lt;input type=&quot;text&quot; /&gt;
    &lt;select&gt;&lt;option&gt;Option&lt;option/&gt;&lt;/select&gt;
    &lt;textarea&gt;&lt;/textarea&gt;
    &lt;button&gt;Button&lt;/button&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="button" return="Array&lt;Element(s)&gt;" timestamp="2008-05-26T02:16:22Z"><sample>:button</sample><added>1.0</added><desc>Matches all button elements and input elements of type button.</desc><longdesc></longdesc><example><desc>Finds all button inputs.</desc><code>
    var input = $(&quot;:button&quot;).css({background:&quot;yellow&quot;, border:&quot;3px red solid&quot;});
    $(&quot;div&quot;).text(&quot;For this type jQuery found &quot; + input.length + &quot;.&quot;)
            .css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;form&quot;).submit(function () { return false; }); // so it won't submit
</code><css>
  textarea { height:45px; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;button&quot; value=&quot;Input Button&quot;/&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;file&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;image&quot; /&gt;
    &lt;input type=&quot;password&quot; /&gt;
    &lt;input type=&quot;radio&quot; /&gt;
    &lt;input type=&quot;reset&quot; /&gt;
    &lt;input type=&quot;submit&quot; /&gt;
    &lt;input type=&quot;text&quot; /&gt;
    &lt;select&gt;&lt;option&gt;Option&lt;option/&gt;&lt;/select&gt;
    &lt;textarea&gt;&lt;/textarea&gt;
    &lt;button&gt;Button&lt;/button&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="file" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:11:01Z"><sample>:file</sample><added>1.0</added><desc>Matches all input elements of type file.</desc><longdesc></longdesc><example><desc>Finds all file inputs.</desc><code>
    var input = $(&quot;:file&quot;).css({background:&quot;yellow&quot;, border:&quot;3px red solid&quot;});
    $(&quot;div&quot;).text(&quot;For this type jQuery found &quot; + input.length + &quot;.&quot;)
            .css(&quot;color&quot;, &quot;red&quot;);
    $(&quot;form&quot;).submit(function () { return false; }); // so it won't submit
</code><css>
  textarea { height:45px; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;button&quot; value=&quot;Input Button&quot;/&gt;
    &lt;input type=&quot;checkbox&quot; /&gt;
    &lt;input type=&quot;file&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;image&quot; /&gt;
    &lt;input type=&quot;password&quot; /&gt;
    &lt;input type=&quot;radio&quot; /&gt;
    &lt;input type=&quot;reset&quot; /&gt;
    &lt;input type=&quot;submit&quot; /&gt;
    &lt;input type=&quot;text&quot; /&gt;
    &lt;select&gt;&lt;option&gt;Option&lt;option/&gt;&lt;/select&gt;
    &lt;textarea&gt;&lt;/textarea&gt;
    &lt;button&gt;Button&lt;/button&gt;
  &lt;/form&gt;
  &lt;div&gt;
  &lt;/div&gt;</html></example></selector><selector cat="Selectors" name="hidden" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T10:58:18Z"><sample>:hidden</sample><added>1.0</added><desc>Matches all elements that are hidden, or input elements of type &quot;hidden&quot;.</desc><longdesc></longdesc><example><desc>Shows all hidden divs and counts hidden inputs.</desc><code>
    // in some browsers :hidden includes head, title, script, etc... so limit to body
    $(&quot;span:first&quot;).text(&quot;Found &quot; + $(&quot;:hidden&quot;, document.body).length + 
                         &quot; hidden elements total.&quot;);
    $(&quot;div:hidden&quot;).show(3000);
    $(&quot;span:last&quot;).text(&quot;Found &quot; + $(&quot;input:hidden&quot;).length + &quot; hidden inputs.&quot;);
</code><css>
  div { width:70px; height:40px; background:#ee77ff; margin:5px; float:left; }
  span { display:block; clear:left; color:red; }
  .starthidden { display:none; }
  </css><html>&lt;span&gt;&lt;/span&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div style=&quot;display:none;&quot;&gt;Hider!&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div class=&quot;starthidden&quot;&gt;Hider!&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;form&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
    &lt;input type=&quot;hidden&quot; /&gt;
  &lt;/form&gt;
  &lt;span&gt;
  &lt;/span&gt;</html></example></selector></subcat><subcat value="Form Filters"><selector cat="Selectors" name="enabled" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:11:12Z"><sample>:enabled</sample><added>1.0</added><desc>Matches all elements that are enabled.</desc><longdesc></longdesc><example><desc>Finds all input elements that are enabled.</desc><code>$(&quot;input:enabled&quot;).val(&quot;this is it&quot;);</code><html>&lt;form&gt;
    &lt;input name=&quot;email&quot; disabled=&quot;disabled&quot; /&gt;
    &lt;input name=&quot;id&quot; /&gt;
  &lt;/form&gt;</html></example></selector><selector cat="Selectors" name="disabled" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:11:25Z"><sample>:disabled</sample><added>1.0</added><desc>Matches all elements that are disabled.</desc><longdesc></longdesc><example><desc>Finds all input elements that are disabled.</desc><code>$(&quot;input:disabled&quot;).val(&quot;this is it&quot;);</code><html>&lt;form&gt;
    &lt;input name=&quot;email&quot; disabled=&quot;disabled&quot; /&gt;
    &lt;input name=&quot;id&quot; /&gt;
  &lt;/form&gt;</html></example></selector><selector cat="Selectors" name="checked" return="Array&lt;Element(s)&gt;" timestamp="2008-04-12T11:12:41Z"><sample>:checked</sample><added>1.0</added><desc>Matches all elements that are checked.</desc><longdesc></longdesc><example><desc>Finds all input elements that are checked.</desc><code>
    function countChecked() {
      var n = $(&quot;input:checked&quot;).length;
      $(&quot;div&quot;).text(n + (n == 1 ? &quot; is&quot; : &quot; are&quot;) + &quot; checked!&quot;);
    }
    countChecked();
    $(&quot;:checkbox&quot;).click(countChecked);
</code><css>
  div { color:red; }
  </css><html>&lt;form&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;newsletter&quot; checked=&quot;checked&quot; value=&quot;Hourly&quot; /&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;newsletter&quot; value=&quot;Daily&quot; /&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;newsletter&quot; value=&quot;Weekly&quot; /&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;newsletter&quot; checked=&quot;checked&quot; value=&quot;Monthly&quot; /&gt;
    &lt;input type=&quot;checkbox&quot; name=&quot;newsletter&quot; value=&quot;Yearly&quot; /&gt;
  &lt;/form&gt;
  &lt;div&gt;&lt;/div&gt;</html><results>[ &lt;input type=&quot;checkbox&quot; name=&quot;newsletter&quot; checked=&quot;checked&quot; value=&quot;Daily&quot; /&gt;,
  &lt;input type=&quot;checkbox&quot; name=&quot;newsletter&quot; checked=&quot;checked&quot; value=&quot;Monthly&quot; /&gt; ]</results></example></selector><selector cat="Selectors" name="selected" return="Array&lt;Element(s)&gt;" timestamp="2008-04-15T03:15:02Z"><sample>:selected</sample><added>1.0</added><desc>Matches all elements that are selected.</desc><longdesc></longdesc><example><desc>Attaches a change event to the select that gets the text for each selected option and writes them in the div.  It then triggers the event for the initial text draw.</desc><code>
    $(&quot;select&quot;).change(function () {
          var str = &quot;&quot;;
          $(&quot;select option:selected&quot;).each(function () {
                str += $(this).text() + &quot; &quot;;
              });
          $(&quot;div&quot;).text(str);
        })
        .trigger('change');
</code><css>
  div { color:red; }
  </css><html>&lt;select name=&quot;garden&quot; multiple=&quot;multiple&quot;&gt;
    &lt;option&gt;Flowers&lt;/option&gt;
    &lt;option selected=&quot;selected&quot;&gt;Shrubs&lt;/option&gt;
    &lt;option&gt;Trees&lt;/option&gt;
    &lt;option selected=&quot;selected&quot;&gt;Bushes&lt;/option&gt;
    &lt;option&gt;Grass&lt;/option&gt;
    &lt;option&gt;Dirt&lt;/option&gt;
  &lt;/select&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></selector></subcat></cat><cat value="Attributes"><subcat value="Attr"><function cat="Attributes" name="attr" return="Object" timestamp="2008-06-03T15:40:58Z"><desc>Access a property on the first matched element. This method makes it easy to retrieve a property value from the first matched element. If the element does not have an attribute with such a name, undefined is returned.</desc><longdesc></longdesc><params name="name" type="String"><desc>The name of the property to access.</desc></params><example><desc>Finds the title attribute of the first &lt;em&gt; in the page.</desc><code>
    var title = $(&quot;em&quot;).attr(&quot;title&quot;);
    $(&quot;div&quot;).text(title);
</code><css>
  em { color:blue; font-weight;bold; }
  div { color:red; }
  </css><html>&lt;p&gt;
    Once there was a &lt;em title=&quot;huge, gigantic&quot;&gt;large&lt;/em&gt; dinosaur...
  &lt;/p&gt;
  The title of the emphasis is:&lt;div&gt;&lt;/div&gt;</html></example></function><function cat="Attributes" name="attr" return="jQuery" timestamp="2008-06-03T15:40:58Z"><desc>Set a key/value object as properties to all matched elements.</desc><longdesc>This serves as the best way to set a large number of properties on all matched elements. Note that you must use 'className' as key if you want to set the class-Attribute. Or use .addClass( class ) or .removeClass( class ). Keep in mind this recursively calls attr( key, value ) or attr ( key, fn ), so if one of the properties you are passing is a function, the function will be evaluated and not stored as the attribute itself.</longdesc><params name="properties" type="Map"><desc>Key/value pairs to set as object properties.</desc></params><example><desc>Set some attributes for all &lt;img&gt;s in the page.</desc><code>
    $(&quot;img&quot;).attr({ 
          src: &quot;/images/hat.gif&quot;,
          title: &quot;jQuery&quot;,
          alt: &quot;jQuery Logo&quot;
        });
    $(&quot;div&quot;).text($(&quot;img&quot;).attr(&quot;alt&quot;));
</code><css>
  img { padding:10px; }
  div { color:red; font-size:24px; }
  </css><html>&lt;img /&gt;
  &lt;img /&gt;
  &lt;img /&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></function><function cat="Attributes" name="attr" return="jQuery" timestamp="2008-06-03T15:40:58Z"><desc>Set a single property to a value, on all matched elements.</desc><longdesc></longdesc><params name="key" type="String"><desc>The name of the property to set.</desc></params><params name="value" type="Object"><desc>The value to set the property to.</desc></params><example><desc>Disables buttons greater than the 1st button.</desc><code>$(&quot;button:gt(1)&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;);</code><css>
  button { margin:10px; }
  </css><html>&lt;button&gt;0th Button&lt;/button&gt;
  &lt;button&gt;1st Button&lt;/button&gt;
  &lt;button&gt;2nd Button&lt;/button&gt;</html></example></function><function cat="Attributes" name="attr" return="jQuery" timestamp="2008-06-03T15:40:58Z"><desc>Set a single property to a computed value, on all matched elements.</desc><longdesc>Instead of supplying a string value as described  <![CDATA[<a href='#keyvalue'>above</a>]]>, a function is provided that computes the value.</longdesc><params name="key" type="String"><desc>The name of the property to set.</desc></params><params name="fn" type="Function"><desc>A function returning the value to set. Scope: Current element, argument: Index of current element
&lt;pre&gt;function callback(indexArray) {
  // indexArray == position in the jQuery object
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Sets id for divs based on the position in the page.</desc><code>
    $(&quot;div&quot;).attr(&quot;id&quot;, function (arr) {
          return &quot;div-id&quot; + arr;
        })
        .each(function () {
          $(&quot;span&quot;, this).html(&quot;(ID = '&lt;b&gt;&quot; + this.id + &quot;&lt;/b&gt;')&quot;);
        });
</code><css>
  div { color:blue; }
  span { color:red; }
  b { font-weight:bolder; }
  </css><html>&lt;div&gt;Zero-th &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;First &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;Second &lt;span&gt;&lt;/span&gt;&lt;/div&gt;</html></example><example><desc>Sets src attribute from title attribute on the image.</desc><code>
    $(&quot;img&quot;).attr(&quot;src&quot;, function() { 
          return &quot;/images/&quot; + this.title; 
        });
</code><html>&lt;img title=&quot;hat.gif&quot;/&gt;
  &lt;img title=&quot;hat-old.gif&quot;/&gt;
  &lt;img title=&quot;hat2-old.gif&quot;/&gt;</html></example></function><function cat="Attributes" name="removeAttr" return="jQuery" timestamp="2007-10-23T08:13:39Z"><desc>Remove an attribute from each of the matched elements.</desc><longdesc></longdesc><params name="name" type="String"><desc>The name of the property to remove.</desc></params><example><desc>Clicking the button enables the input next to it.</desc><code>
    $(&quot;button&quot;).click(function () {
      $(this).next().removeAttr(&quot;disabled&quot;)
             .focus()
             .val(&quot;editable now&quot;);
    });
</code><html>&lt;button&gt;Enable&lt;/button&gt;
  &lt;input type=&quot;text&quot; disabled=&quot;disabled&quot; value=&quot;can't edit this&quot; /&gt;</html></example></function></subcat><subcat value="Class"><function cat="Attributes" name="addClass" return="jQuery" timestamp="2007-10-23T08:22:10Z"><desc>Adds the specified class(es) to each of the set of matched elements.</desc><longdesc></longdesc><params name="class" type="String"><desc>One or more CSS classes to add to the elements, these are separated by spaces.</desc></params><example><desc>Adds the class 'selected' to the matched elements.</desc><code>$(&quot;p:last&quot;).addClass(&quot;selected&quot;);</code><css>
  p { margin: 8px; font-size:16px; }
  .selected { color:red; }
  .highlight { background:yellow; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;and&lt;/p&gt;
  &lt;p&gt;Goodbye&lt;/p&gt;</html></example><example><desc>Adds the classes 'selected' and 'highlight' to the matched elements.</desc><code>$(&quot;p:last&quot;).addClass(&quot;selected highlight&quot;);</code><css>
  p { margin: 8px; font-size:16px; }
  .selected { color:red; }
  .highlight { background:yellow; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;and&lt;/p&gt;
  &lt;p&gt;Goodbye&lt;/p&gt;</html></example></function><function cat="Attributes" name="hasClass" return="Boolean" timestamp="2008-02-02T16:29:45Z"><desc>Returns true if the specified class is present on at least one of the set of matched elements.</desc><longdesc></longdesc><params name="class" type="String"><desc>One CSS class name to be checked for.</desc></params><example><desc>Looks for the class 'selected' on the matched elements.</desc><code>$(&quot;div#result1&quot;).append($(&quot;p:first&quot;).hasClass(&quot;selected&quot;).toString());
$(&quot;div#result2&quot;).append($(&quot;p:last&quot;).hasClass(&quot;selected&quot;).toString());
$(&quot;div#result3&quot;).append($(&quot;p&quot;).hasClass(&quot;selected&quot;).toString());</code><css>
  p { margin: 8px; font-size:16px; }
  .selected { color:red; }
  .highlight { background:yellow; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p class=&quot;selected&quot;&gt;Goodbye&lt;/p&gt;
  &lt;div id=&quot;result1&quot;&gt;First paragraph has selected class: &lt;/div&gt;
  &lt;div id=&quot;result2&quot;&gt;Last paragraph has selected class: &lt;/div&gt;
  &lt;div id=&quot;result3&quot;&gt;Some paragraph has selected class: &lt;/div&gt;</html></example></function><function cat="Attributes" name="removeClass" return="jQuery" timestamp="2008-04-17T04:58:42Z"><desc>Removes all or the specified class(es) from the set of matched elements.</desc><longdesc></longdesc><params name="class" optional="true" type="String"><desc>One or more CSS classes to remove from the elements, these are separated by spaces.</desc></params><example><desc>Remove the class 'blue' from the matched elements.</desc><code>$(&quot;p:even&quot;).removeClass(&quot;blue&quot;);</code><css>
  p { margin: 4px; font-size:16px; font-weight:bolder; }
  .blue { color:blue; }
  .under { text-decoration:underline; }
  .highlight { background:yellow; }
  </css><html>&lt;p class=&quot;blue under&quot;&gt;Hello&lt;/p&gt;
  &lt;p class=&quot;blue under highlight&quot;&gt;and&lt;/p&gt;
  &lt;p class=&quot;blue under&quot;&gt;then&lt;/p&gt;
  &lt;p class=&quot;blue under&quot;&gt;Goodbye&lt;/p&gt;</html></example><example><desc>Remove the class 'blue' and 'under' from the matched elements.</desc><code>$(&quot;p:odd&quot;).removeClass(&quot;blue under&quot;);</code><css>
  p { margin: 4px; font-size:16px; font-weight:bolder; }
  .blue { color:blue; }
  .under { text-decoration:underline; }
  .highlight { background:yellow; }
  </css><html>&lt;p class=&quot;blue under&quot;&gt;Hello&lt;/p&gt;
  &lt;p class=&quot;blue under highlight&quot;&gt;and&lt;/p&gt;
  &lt;p class=&quot;blue under&quot;&gt;then&lt;/p&gt;
  &lt;p class=&quot;blue under&quot;&gt;Goodbye&lt;/p&gt;</html></example><example><desc>Remove all the classes from the matched elements.</desc><code>$(&quot;p:eq(1)&quot;).removeClass();</code><css>
  p { margin: 4px; font-size:16px; font-weight:bolder; }
  .blue { color:blue; }
  .under { text-decoration:underline; }
  .highlight { background:yellow; }
  </css><html>&lt;p class=&quot;blue under&quot;&gt;Hello&lt;/p&gt;
  &lt;p class=&quot;blue under highlight&quot;&gt;and&lt;/p&gt;
  &lt;p class=&quot;blue under&quot;&gt;then&lt;/p&gt;
  &lt;p class=&quot;blue under&quot;&gt;Goodbye&lt;/p&gt;</html></example></function><function cat="Attributes" name="toggleClass" return="jQuery" timestamp="2007-10-23T08:50:30Z"><desc>Adds the specified class if it is not present, removes the specified class if it is present.</desc><longdesc></longdesc><params name="class" type="String"><desc>A CSS class to toggle on the elements.</desc></params><example><desc>Toggle the class 'highlight' when a paragraph is clicked.</desc><code>
    $(&quot;p&quot;).click(function () {
      $(this).toggleClass(&quot;highlight&quot;);
    });
</code><css>
  p { margin: 4px; font-size:16px; font-weight:bolder; 
      cursor:pointer; }
  .blue { color:blue; }
  .highlight { background:yellow; }
  </css><html>&lt;p class=&quot;blue&quot;&gt;Click to toggle&lt;/p&gt;
  &lt;p class=&quot;blue highlight&quot;&gt;highlight&lt;/p&gt;
  &lt;p class=&quot;blue&quot;&gt;on these&lt;/p&gt;
  &lt;p class=&quot;blue&quot;&gt;paragraphs&lt;/p&gt;</html></example></function></subcat><subcat value="HTML"><function cat="Attributes" name="html" return="String" timestamp="2008-04-17T03:59:51Z"><desc>Get the html contents (innerHTML) of the first matched element. This property is not available on XML documents (although it will work for XHTML documents).</desc><longdesc></longdesc><example><desc>Click a paragraph to convert it from html to text.</desc><code>
    $(&quot;p&quot;).click(function () {
      var htmlStr = $(this).html();
      $(this).text(htmlStr);
    });
</code><css>
  p { margin:8px; font-size:20px; color:blue; 
      cursor:pointer; }
  b { text-decoration:underline; }
  button { cursor:pointer; }
  </css><html>&lt;p&gt;
    &lt;b&gt;Click&lt;/b&gt; to change the &lt;span id=&quot;tag&quot;&gt;html&lt;/span&gt;
  &lt;/p&gt;
  &lt;p&gt;
    to a &lt;span id=&quot;text&quot;&gt;text&lt;/span&gt; node.
  &lt;/p&gt;
  &lt;p&gt;
    This &lt;button name=&quot;nada&quot;&gt;button&lt;/button&gt; does nothing.
  &lt;/p&gt;</html></example></function><function cat="Attributes" name="html" return="jQuery" timestamp="2008-04-17T03:59:51Z"><desc>Set the html contents of every matched element. This property is not available on XML documents (although it will work for XHTML documents).</desc><longdesc></longdesc><params name="val" type="String"><desc>Set the html contents to the specified value.</desc></params><example><desc>Add some html to each div.</desc><code>$(&quot;div&quot;).html(&quot;&lt;span class='red'&gt;Hello &lt;b&gt;Again&lt;/b&gt;&lt;/span&gt;&quot;);</code><css>
  .red { color:red; }
  </css><html>&lt;span&gt;Hello&lt;/span&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example><example><desc>Add some html to each div then immediately do further manipulations to the inserted html.</desc><code>
    $(&quot;div&quot;).html(&quot;&lt;b&gt;Wow!&lt;/b&gt; Such excitement...&quot;);
    $(&quot;div b&quot;).append(document.createTextNode(&quot;!!!&quot;))
              .css(&quot;color&quot;, &quot;red&quot;);
</code><css>
  div { color:blue; font-size:18px; }
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></function></subcat><subcat value="Text"><function cat="Attributes" name="text" return="String" timestamp="2007-11-24T05:10:51Z"><desc>Get the combined text contents of all matched elements.</desc><longdesc>The result is a string that contains the combined text contents of all matched elements. This method works on both HTML and XML documents.</longdesc><example><desc>Find the text in the first paragraph (stripping out the html), then set the html of the last paragraph to show it is just text (the red bold is gone).</desc><code>
    var str = $(&quot;p:first&quot;).text();
    $(&quot;p:last&quot;).html(str);
</code><css>
  p { color:blue; margin:8px; }
  b { color:red; }
  </css><html>&lt;p&gt;&lt;b&gt;Test&lt;/b&gt; Paragraph.&lt;/p&gt;
  &lt;p&gt;&lt;/p&gt;</html></example></function><function cat="Attributes" name="text" return="jQuery" timestamp="2007-11-24T05:10:51Z"><desc>Set the text contents of all matched elements.</desc><longdesc>Similar to html(), but escapes HTML (replace &quot;&lt;&quot; and &quot;&gt;&quot; with their HTML entities).</longdesc><params name="val" type="String"><desc>The text value to set the contents of the element to.</desc></params><example><desc>Add text to the paragraph (notice the bold tag is escaped).</desc><code>$(&quot;p&quot;).text(&quot;&lt;b&gt;Some&lt;/b&gt; new text.&quot;);</code><css>
  p { color:blue; margin:8px; }
  </css><html>&lt;p&gt;Test Paragraph.&lt;/p&gt;</html></example></function></subcat><subcat value="Value"><function cat="Attributes" name="val" return="String, Array" timestamp="2008-05-08T05:57:08Z"><added>1.0</added><desc>Get the content of the value attribute of the first matched element.</desc><longdesc>In jQuery 1.2, a value is now returned for all elements, including selects. For multiple selects an array of values is returned.

For older versions of jQuery use the [http://www.malsup.com/jquery/form/#fields fieldValue function of the Form Plugin].

For selects and checkboxes, see the <![CDATA[<a href='Selectors/selected'>:selected</a>]]> and <![CDATA[<a href='Selectors/checked'>:checked</a>]]> selectors.</longdesc><example><desc>Get the single value from a single select and an array of values from a multiple select and display their values.</desc><code>
    function displayVals() {
      var singleValues = $(&quot;#single&quot;).val();
      var multipleValues = $(&quot;#multiple&quot;).val() || [];
      $(&quot;p&quot;).html(&quot;&lt;b&gt;Single:&lt;/b&gt; &quot; + 
                  singleValues +
                  &quot; &lt;b&gt;Multiple:&lt;/b&gt; &quot; + 
                  multipleValues.join(&quot;, &quot;));
    }

    $(&quot;select&quot;).change(displayVals);
    displayVals();
</code><css>
  p { color:red; margin:4px; }
  b { color:blue; }
  </css><html>&lt;p&gt;&lt;/p&gt;
  &lt;select id=&quot;single&quot;&gt;
    &lt;option&gt;Single&lt;/option&gt;
    &lt;option&gt;Single2&lt;/option&gt;
  &lt;/select&gt;
  &lt;select id=&quot;multiple&quot; multiple=&quot;multiple&quot;&gt;
    &lt;option selected=&quot;selected&quot;&gt;Multiple&lt;/option&gt;
    &lt;option&gt;Multiple2&lt;/option&gt;
    &lt;option selected=&quot;selected&quot;&gt;Multiple3&lt;/option&gt;
  &lt;/select&gt;</html></example><example><desc>Find the value of an input box.</desc><code>
    $(&quot;input&quot;).keyup(function () {
      var value = $(this).val();
      $(&quot;p&quot;).text(value);
    }).keyup();
</code><css>
  p { color:blue; margin:8px; }
  </css><html>&lt;input type=&quot;text&quot; value=&quot;some text&quot;/&gt;
  &lt;p&gt;&lt;/p&gt;</html></example></function><function cat="Attributes" name="val" return="jQuery" timestamp="2008-05-08T05:57:08Z"><added>1.0</added><desc>Set the value attribute of every matched element.</desc><longdesc>In jQuery 1.2, this is also able to set the value of select elements, but selecting the appropriate options.</longdesc><params name="val" type="String"><desc>The value to set on the matched element.</desc></params><example><desc>Set the value of an input box.</desc><code>
    $(&quot;button&quot;).click(function () {
      var text = $(this).text();
      $(&quot;input&quot;).val(text);
    });
</code><css>
  button { margin:4px; cursor:pointer; }
  input { margin:4px; color:blue; }
  </css><html>&lt;div&gt;
    &lt;button&gt;Feed&lt;/button&gt;
    &lt;button&gt;the&lt;/button&gt;
    &lt;button&gt;Input&lt;/button&gt;
  &lt;/div&gt;
  &lt;input type=&quot;text&quot; value=&quot;click a button&quot; /&gt;</html></example></function><function cat="Attributes" name="val" return="jQuery" timestamp="2008-05-08T05:57:08Z"><added>1.2</added><desc>Checks, or selects, all the radio buttons, checkboxes, and select options that match the set of values.</desc><longdesc></longdesc><params name="val" type="Array&lt;String&gt;"><desc>The set of values to check/select.</desc></params><example><desc>Set a single select and a multiple select .</desc><code>
    $(&quot;#single&quot;).val(&quot;Single2&quot;);
    $(&quot;#multiple&quot;).val([&quot;Multiple2&quot;, &quot;Multiple3&quot;]);
    $(&quot;input&quot;).val([&quot;check1&quot;,&quot;check2&quot;, &quot;radio1&quot; ]);
</code><css>
  body { color:blue; }
  </css><html>&lt;select id=&quot;single&quot;&gt;
    &lt;option&gt;Single&lt;/option&gt;
    &lt;option&gt;Single2&lt;/option&gt;
  &lt;/select&gt;
  &lt;select id=&quot;multiple&quot; multiple=&quot;multiple&quot;&gt;
    &lt;option selected=&quot;selected&quot;&gt;Multiple&lt;/option&gt;
    &lt;option&gt;Multiple2&lt;/option&gt;
    &lt;option selected=&quot;selected&quot;&gt;Multiple3&lt;/option&gt;
  &lt;/select&gt;&lt;br/&gt;
  &lt;input type=&quot;checkbox&quot; name=&quot;checkboxname&quot; value=&quot;check1&quot;/&gt; check1
  &lt;input type=&quot;checkbox&quot; name=&quot;checkboxname&quot; value=&quot;check2&quot;/&gt; check2
  &lt;input type=&quot;radio&quot;  name=&quot;r&quot; value=&quot;radio1&quot;/&gt; radio1
  &lt;input type=&quot;radio&quot;  name=&quot;r&quot; value=&quot;radio2&quot;/&gt; radio2</html></example></function></subcat></cat><cat value="Traversing"><subcat value="Filtering"><function cat="Traversing" name="eq" return="jQuery" timestamp="2008-05-10T11:13:56Z"><added>1.1.2</added><desc>Reduce the set of matched elements to a single element. </desc><longdesc>The position of the element in the set of matched elements starts at 0 and goes to length - 1.</longdesc><params name="index" type="Integer"><desc>The index of the element in the jQuery object.</desc></params><example><desc>Turn the div with index 2 blue by adding an appropriate class.</desc><code>
    $(&quot;div&quot;).eq(2).addClass(&quot;blue&quot;);
</code><css>
  div { width:60px; height:60px; margin:10px; float:left;
        border:2px solid blue; }
  .blue { background:blue; }
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></function><function cat="Traversing" name="hasClass" return="Boolean" timestamp="2007-10-23T11:05:26Z"><added>1.2</added><desc>Checks the current selection against a class and returns true, if at least one element of the selection has the given class.</desc><longdesc>This is an alternative to is(&quot;.&quot; + class).</longdesc><params name="class" type="String"><desc>The class to match.</desc></params><example><desc>Check to see if an element has a specific class, and if so, perform an action.</desc><code>
    $(&quot;div&quot;).click(function(){
      if ( $(this).hasClass(&quot;protected&quot;) )
        $(this).animate({ left: -10 }, 75)
               .animate({ left: 10 }, 75)
               .animate({ left: -10 }, 75)
               .animate({ left: 10 }, 75)
               .animate({ left: 0 }, 75);
    });
</code><css>
  div { width: 80px; height: 80px; background: #abc; 
        position: relative; border: 2px solid black; 
        margin: 20px 0px; float: left; left:0 }
  div.protected { border-color: red; }
  span { display:block; float:left; width:20px; 
         height:20px; }
  </css><html>&lt;span&gt;&lt;/span&gt;&lt;div class=&quot;protected&quot;&gt;&lt;/div&gt;
  &lt;span&gt;&lt;/span&gt;&lt;div&gt;&lt;/div&gt;
  &lt;span&gt;&lt;/span&gt;&lt;div&gt;&lt;/div&gt;
  &lt;span&gt;&lt;/span&gt;&lt;div class=&quot;protected&quot;&gt;&lt;/div&gt;</html></example></function><function cat="Traversing" name="filter" return="jQuery" timestamp="2007-10-24T23:35:26Z"><added>1.0</added><desc>Removes all elements from the set of matched elements that do not match the specified expression(s). </desc><longdesc>This method is used to narrow down the results of a search.

Provide a comma-separated list of expressions to apply multiple filters at once.</longdesc><params name="expr" type="Expression"><desc>An expression to pass into the filter</desc></params><example><desc>Change the color of all divs then put a border around only some of them.</desc><code>
    $(&quot;div&quot;).css(&quot;background&quot;, &quot;#c8ebcc&quot;)
            .filter(&quot;.middle&quot;)
            .css(&quot;border-color&quot;, &quot;red&quot;);
</code><css>
  div { width:60px; height:60px; margin:5px; float:left; 
        border:2px white solid;}
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;div class=&quot;middle&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;middle&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;middle&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;middle&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example><example><desc>Selects all paragraphs and removes those without a class &quot;selected&quot;.</desc><code>$(&quot;p&quot;).filter(&quot;.selected&quot;)</code></example><example><desc>Selects all paragraphs and removes those that aren't of class &quot;selected&quot; or the first one.</desc><code>$(&quot;p&quot;).filter(&quot;.selected, :first&quot;)</code></example></function><function cat="Traversing" name="filter" return="jQuery" timestamp="2007-10-24T23:35:26Z"><added>1.0</added><desc>Removes all elements from the set of matched elements that does not match the specified function. </desc><longdesc>The function is called with a context equal to the current element (just like <![CDATA[<a href='Core/each'>$.each</a>]]>). If the function returns false, then the element is removed - anything else and the element is kept.</longdesc><params name="fn" type="Function"><desc>A function to pass into the filter
&lt;pre&gt;function callback(indexInJQueryObject) {
  var keepItBoolean = true;

  this; // dom element

  return keepItBoolean;
}
&lt;/pre&gt;</desc></params><example><desc>Change the color of all divs then put a border two specific ones.</desc><code>
    $(&quot;div&quot;).css(&quot;background&quot;, &quot;#b4b0da&quot;)
            .filter(function (index) {
                  return index == 1 || $(this).attr(&quot;id&quot;) == &quot;fourth&quot;;
                })
            .css(&quot;border&quot;, &quot;3px double red&quot;);
</code><css>
  div { width:60px; height:60px; margin:5px; float:left; 
        border:3px white solid; }
  </css><html>&lt;div id=&quot;first&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;second&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;third&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;fourth&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;fifth&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;sixth&quot;&gt;&lt;/div&gt;</html></example><example><desc>Remove all elements that have a descendant ol element</desc><code> $(&quot;p&quot;).filter(function(index) {
   return $(&quot;ol&quot;, this).length == 0;
 });</code></example></function><function cat="Traversing" name="is" return="Boolean" timestamp="2008-05-25T01:28:03Z"><added>1.0</added><desc>Checks the current selection against an expression and returns true, if at least one element of the selection fits the given expression.</desc><longdesc>If no element fits, or the expression is not valid, then the response will be 'false'. Note that only simple expressions are supported. Complex expressions, such as those containing hierarchy selectors (such as +, ~, and &gt;) will always return 'true'.

<![CDATA[<a href='Traversing/filter'>filter</a>]]> is used internally, therefore all rules that apply there apply here, as well. </longdesc><params name="expr" type="String"><desc>The expression with which to filter</desc></params><example><desc>Shows a few ways is() can be used inside an event handler.</desc><code>
    $(&quot;div&quot;).one('click', function () {
      if ($(this).is(&quot;:first-child&quot;)) {
        $(&quot;p&quot;).text(&quot;It's the first div.&quot;);
      } else if ($(this).is(&quot;.blue,.red&quot;)) {
        $(&quot;p&quot;).text(&quot;It's a blue or red div.&quot;);
      } else if ($(this).is(&quot;:contains('Peter')&quot;)) {
        $(&quot;p&quot;).text(&quot;It's Peter!&quot;);
      } else {
        $(&quot;p&quot;).html(&quot;It's nothing &lt;em&gt;special&lt;/em&gt;.&quot;);
      }
      $(&quot;p&quot;).hide().slideDown(&quot;slow&quot;);
      $(this).css({&quot;border-style&quot;: &quot;inset&quot;, cursor:&quot;default&quot;});
    });
</code><css>
  div { width:60px; height:60px; margin:5px; float:left;
        border:4px outset; background:green; text-align:center; 
        font-weight:bolder; cursor:pointer; }
  .blue { background:blue; }
  .red { background:red; }
  span { color:white; font-size:16px; }
  p { color:red; font-weight:bolder; background:yellow; 
      margin:3px; clear:left; display:none; }
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;div class=&quot;blue&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div class=&quot;red&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;br/&gt;&lt;span&gt;Peter&lt;/span&gt;&lt;/div&gt;
  &lt;div class=&quot;blue&quot;&gt;&lt;/div&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;</html></example><example><desc>Returns true, because the parent of the input is a form element</desc><code>
    var isFormParent = $(&quot;input[@type='checkbox']&quot;).parent().is(&quot;form&quot;)
    $(&quot;div&quot;).text(&quot;isFormParent = &quot; + isFormParent);
</code><css>div { color:red; }</css><html>&lt;form&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/form&gt;
  &lt;div&gt;&lt;/div&gt;</html></example><example><desc>Returns false, because the parent of the input is a p element</desc><code>
    var isFormParent = $(&quot;input[@type='checkbox']&quot;).parent().is(&quot;form&quot;)
    $(&quot;div&quot;).text(&quot;isFormParent = &quot; + isFormParent);
</code><css>div { color:red; }</css><html>&lt;form&gt;&lt;p&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/p&gt;&lt;/form&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></function><function cat="Traversing" name="map" return="jQuery" timestamp="2007-10-25T03:24:55Z"><added>1.2</added><desc>Translate a set of elements in the jQuery object into another set of values in an array (which may, or may not, be elements).</desc><longdesc>You could use this to build lists of values, attributes, css values - or even perform special, custom, selector transformations.

This is provided as a convenience method for using <![CDATA[<a href='Utilities/jQuery.map'>$.map()</a>]]>.</longdesc><params name="callback" type="Function"><desc>The function to execute on each element in the set.
&lt;pre&gt;function callback(index, domElement) {
  var replacement;

  this; // also dom element

  // replacement == null : delete spot
  // replacement == array : insert the elements of the array
  // else replace the spot with replacement
  return replacement;
}
&lt;/pre&gt;</desc></params><example><desc>Build a list of all the values within a form.</desc><code>
    $(&quot;p&quot;).append( $(&quot;input&quot;).map(function(){
      return $(this).val();
    }).get().join(&quot;, &quot;) );
</code><css>
  p { color:red; }
  </css><html>&lt;p&gt;&lt;b&gt;Values: &lt;/b&gt;&lt;/p&gt;
  &lt;form&gt;
    &lt;input type=&quot;text&quot; name=&quot;name&quot; value=&quot;John&quot;/&gt;
    &lt;input type=&quot;text&quot; name=&quot;password&quot; value=&quot;password&quot;/&gt;
    &lt;input type=&quot;text&quot; name=&quot;url&quot; value=&quot;http://ejohn.org/&quot;/&gt;
  &lt;/form&gt;</html></example><example><desc>A contrived example to show some functionality.</desc><code>
    var mappedItems = $(&quot;li&quot;).map(function (index) {
      var replacement = $(&quot;&lt;li&gt;&quot;).text($(this).text()).get(0);
      if (index == 0) {
        // make the first item all caps
        $(replacement).text($(replacement).text().toUpperCase());
      } else if (index == 1 || index == 3) {
        // delete the second and fourth items
        replacement = null;
      } else if (index == 2) {
        // make two of the third item and add some text
        replacement = [replacement,$(&quot;&lt;li&gt;&quot;).get(0)];
        $(replacement[0]).append(&quot;&lt;b&gt; - A&lt;/b&gt;&quot;);
        $(replacement[1]).append(&quot;Extra &lt;b&gt; - B&lt;/b&gt;&quot;);
      }

      // replacment will be an dom element, null, 
      // or an array of dom elements
      return replacement;
    });
    $(&quot;#results&quot;).append(mappedItems);
</code><css>
  body { font-size:16px; }
  ul { float:left; margin:0 30px; color:blue; }
  #results { color:red; }
  </css><html>&lt;ul&gt;
    &lt;li&gt;First&lt;/li&gt;
    &lt;li&gt;Second&lt;/li&gt;
    &lt;li&gt;Third&lt;/li&gt;
    &lt;li&gt;Fourth&lt;/li&gt;
    &lt;li&gt;Fifth&lt;/li&gt;
  &lt;/ul&gt;
  &lt;ul id=&quot;results&quot;&gt;
  &lt;/ul&gt;</html></example></function><function cat="Traversing" name="not" return="jQuery" timestamp="2007-10-25T07:32:16Z"><added>1.0</added><desc>Removes elements matching the specified expression from the set of matched elements.</desc><longdesc></longdesc><params name="expr" type="String, DOMElement, Array&lt;DOMElement&gt;"><desc>An expression with which to remove matching elements, an element to remove from the set or a set of elements to remove from the jQuery set of matched elements.</desc></params><example><desc>Adds a border to divs that are not green or blue.</desc><code>
    $(&quot;div&quot;).not(&quot;.green, #blueone&quot;)
            .css(&quot;border-color&quot;, &quot;red&quot;);
</code><css>
  div { width:60px; height:60px; margin:10px; float:left;
        background:yellow; border:2px solid white; }
  .green { background:#8f8; }
  .gray { background:#ccc; }
  #blueone { background:#99f; }
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;div id=&quot;blueone&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div class=&quot;green&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;green&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;gray&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example><example><desc>Removes the element with the ID &quot;selected&quot; from the set of all paragraphs.</desc><code>$(&quot;p&quot;).not( $(&quot;#selected&quot;)[0] )</code></example><example><desc>Removes the element with the ID &quot;selected&quot; from the set of all paragraphs.</desc><code>$(&quot;p&quot;).not(&quot;#selected&quot;)</code></example><example><desc>Removes all elements that match &quot;div p.selected&quot; from the total set of all paragraphs.</desc><code>$(&quot;p&quot;).not($(&quot;div p.selected&quot;))</code></example></function><function cat="Traversing" name="slice" return="jQuery" timestamp="2007-10-25T13:19:40Z"><added>1.1.4</added><desc>Selects a subset of the matched elements.</desc><longdesc>Behaves exactly like the built-in Array slice method. </longdesc><params name="start" type="Integer"><desc>Where to start the subset. The first element is at zero. Can be negative to start from the end of the selection.</desc></params><params name="end" optional="true" type="Integer"><desc>Where to end the subset. If unspecified, ends at the end of the selection.</desc></params><example><desc>Turns divs yellow based on a random slice.</desc><code>
    function colorEm() {
      var $div = $(&quot;div&quot;);
      var start = Math.floor(Math.random() *
                             $div.length);
      var end = Math.floor(Math.random() *
                           ($div.length - start)) +
                           start + 1;
      if (end == $div.length) end = undefined;
      $div.css(&quot;background&quot;, &quot;&quot;);
      if (end) 
        $div.slice(start, end).css(&quot;background&quot;, &quot;yellow&quot;);   
       else
        $div.slice(start).css(&quot;background&quot;, &quot;yellow&quot;);
      
      $(&quot;span&quot;).text('$(&quot;div&quot;).slice(' + start +
                     (end ? ', ' + end : '') +
                     ').css(&quot;background&quot;, &quot;yellow&quot;);');
    }

    $(&quot;button&quot;).click(colorEm);
</code><css>
  div { width:40px; height:40px; margin:10px; float:left;
        border:2px solid blue; }
  span { color:red; font-weight:bold; }
  button { margin:5px; }
  </css><html>&lt;button&gt;Turn slice yellow&lt;/button&gt;
  &lt;span&gt;Click the button!&lt;/span&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example><example><desc>Selects all paragraphs, then slices the selection to include only the first element.</desc><code>$(&quot;p&quot;).slice(0, 1).wrapInner(&quot;&lt;b&gt;&lt;/b&gt;&quot;);</code></example><example><desc>Selects all paragraphs, then slices the selection to include only the first and second element.</desc><code>$(&quot;p&quot;).slice(0, 2).wrapInner(&quot;&lt;b&gt;&lt;/b&gt;&quot;);</code></example><example><desc>Selects all paragraphs, then slices the selection to include only the second element.</desc><code>$(&quot;p&quot;).slice(1, 2).wrapInner(&quot;&lt;b&gt;&lt;/b&gt;&quot;);</code></example><example><desc>Selects all paragraphs, then slices the selection to include only the second and third element.</desc><code>$(&quot;p&quot;).slice(1).wrapInner(&quot;&lt;b&gt;&lt;/b&gt;&quot;);</code></example><example><desc>Selects all paragraphs, then slices the selection to include only the third element.</desc><code>$(&quot;p&quot;).slice(-1).wrapInner(&quot;&lt;b&gt;&lt;/b&gt;&quot;);</code></example></function></subcat><subcat value="Finding"><function cat="Traversing" name="add" return="jQuery" timestamp="2007-10-25T23:23:42Z"><added>1.0</added><desc>Adds more elements, matched by the given expression, to the set of matched elements.</desc><longdesc></longdesc><params name="expr" type="String, DOMElement, Array&lt;DOMElement&gt;"><desc>An expression whose matched elements are added for String, a string of HTML to create on the fly for DOMElement or one or more Elements to add if an Array.</desc></params><example><desc>Finds all divs and makes a border.  Then adds all paragraphs to the jQuery object to set their backgrounds yellow.</desc><code>
    $(&quot;div&quot;).css(&quot;border&quot;, &quot;2px solid red&quot;)
            .add(&quot;p&quot;)
            .css(&quot;background&quot;, &quot;yellow&quot;);
</code><css>
  div { width:60px; height:60px; margin:10px; float:left; }
  p { clear:left; font-weight:bold; font-size:16px; 
      color:blue; margin:0 10px; padding:2px; }
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;p&gt;Added this... (notice no border)&lt;/p&gt;</html></example><example><desc>Adds more elements, matched by the given expression, to the set of matched elements.</desc><code>$(&quot;p&quot;).add(&quot;span&quot;).css(&quot;background&quot;, &quot;yellow&quot;);</code><html>&lt;p&gt;Hello&lt;/p&gt;&lt;span&gt;Hello Again&lt;/span&gt;</html></example><example><desc>Adds more elements, created on the fly, to the set of matched elements.</desc><code>$(&quot;p&quot;).clone().add(&quot;&amp;lt;span&gt;Again&amp;lt;/span&gt;&quot;).appendTo(document.body);</code><html>&lt;p&gt;Hello&lt;/p&gt;</html></example><example><desc>Adds one or more Elements to the set of matched elements.</desc><code>$(&quot;p&quot;).add(document.getElementById(&quot;a&quot;)).css(&quot;background&quot;, &quot;yellow&quot;);</code><html>&lt;p&gt;Hello&lt;/p&gt;&lt;span id=&quot;a&quot;&gt;Hello Again&lt;/span&gt;</html></example></function><function cat="Traversing" name="children" return="jQuery" timestamp="2007-11-28T02:34:16Z"><added>1.0</added><desc>Get a set of elements containing all of the unique immediate children of each of the matched set of elements.</desc><longdesc>This set can be filtered with an optional expression that will cause only elements matching the selector to be collected. Also note: while parents() will look at all ancestors, children() will only consider immediate child elements.</longdesc><params name="expr" optional="true" type="String"><desc>An expression to filter the child Elements with.</desc></params><example><desc>Find all children of the clicked element.</desc><code>
    $(&quot;#container&quot;).click(function (e) {
      $(&quot;*&quot;).removeClass(&quot;hilite&quot;);
      var $kids = $(e.target).children();
      var len = $kids.addClass(&quot;hilite&quot;).length;

      $(&quot;#results span:first&quot;).text(len);
      $(&quot;#results span:last&quot;).text(e.target.tagName);

      e.preventDefault();
      return false;
    });
</code><css>
  body { font-size:16px; font-weight:bolder; }
  div { width:130px; height:82px; margin:10px; float:left;
        border:1px solid blue; padding:4px; }
  #container { width:auto; height:105px; margin:0; float:none;
        border:none; }
  .hilite { border-color:red; }
  #results { display:block; color:red; }
  p { margin:10px; border:1px solid transparent; }
  span { color:blue; border:1px solid transparent; }
  input { width:100px; }
  em { border:1px solid transparent; }
  a { border:1px solid transparent; }
  b { border:1px solid transparent; }
  button { border:1px solid transparent; }
  </css><html>&lt;div id=&quot;container&quot;&gt;
    &lt;div&gt;
      &lt;p&gt;This &lt;span&gt;is the &lt;em&gt;way&lt;/em&gt; we&lt;/span&gt; 
      write &lt;em&gt;the&lt;/em&gt; demo,&lt;/p&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;a href=&quot;#&quot;&gt;&lt;b&gt;w&lt;/b&gt;rit&lt;b&gt;e&lt;/b&gt;&lt;/a&gt; the &lt;span&gt;demo,&lt;/span&gt; &lt;button&gt;write 
      the&lt;/button&gt; demo,
    &lt;/div&gt;
    &lt;div&gt;
      This &lt;span&gt;the way we &lt;em&gt;write&lt;/em&gt; the &lt;em&gt;demo&lt;/em&gt; so&lt;/span&gt;
      &lt;input type=&quot;text&quot; value=&quot;early&quot; /&gt; in
    &lt;/div&gt;
    &lt;p&gt;
      &lt;span&gt;t&lt;/span&gt;he &lt;span&gt;m&lt;/span&gt;orning.
      &lt;span id=&quot;results&quot;&gt;Found &lt;span&gt;0&lt;/span&gt; children in &lt;span&gt;TAG&lt;/span&gt;.&lt;/span&gt;
    &lt;/p&gt;
  &lt;/div&gt;</html></example><example><desc>Find all children of each div.</desc><code>$(&quot;div&quot;).children().css(&quot;border-bottom&quot;, &quot;3px double red&quot;);</code><css>
  body { font-size:16px; font-weight:bolder; }
  span { color:blue; }
  p { margin:5px 0; }
  </css><html>&lt;p&gt;Hello (this is a paragraph)&lt;/p&gt;
  &lt;div&gt;&lt;span&gt;Hello Again (this span is a child of the a div)&lt;/span&gt;&lt;/div&gt;
  &lt;p&gt;And &lt;span&gt;Again&lt;/span&gt; (in another paragraph)&lt;/p&gt;
  &lt;div&gt;And One Last &lt;span&gt;Time&lt;/span&gt; (most text directly in a div)&lt;/div&gt;</html></example><example><desc>Find all children with a class &quot;selected&quot; of each div.</desc><code>$(&quot;div&quot;).children(&quot;.selected&quot;).css(&quot;color&quot;, &quot;blue&quot;);</code><css>
  body { font-size:16px; font-weight:bolder; }
  p { margin:5px 0; }
  </css><html>&lt;div&gt;
    &lt;span&gt;Hello&lt;/span&gt;
    &lt;p class=&quot;selected&quot;&gt;Hello Again&lt;/p&gt;
    &lt;div class=&quot;selected&quot;&gt;And Again&lt;/div&gt;
    &lt;p&gt;And One Last Time&lt;/p&gt;
  &lt;/div&gt;</html></example></function><function cat="Traversing" name="contents" return="jQuery" timestamp="2007-11-30T10:36:11Z"><added>1.2</added><desc>Find all the child nodes inside the matched elements (including text nodes), or the content document, if the element is an iframe.</desc><longdesc></longdesc><example><desc>Find all the text nodes inside a paragraph and wrap them with a bold tag.</desc><code>$(&quot;p&quot;).contents().not(&quot;[nodeType=1]&quot;).wrap(&quot;&lt;b/&gt;&quot;);</code><html>&lt;p&gt;Hello &lt;a href=&quot;http://ejohn.org/&quot;&gt;John&lt;/a&gt;, how are you doing?&lt;/p&gt;</html></example><example><desc>Append some new content into an empty iframe.</desc><code>$(&quot;iframe&quot;).contents().find(&quot;body&quot;).append(&quot;I'm in an iframe!&quot;);</code><html>&lt;iframe src=&quot;/index-blank.html&quot; width=&quot;300&quot; height=&quot;100&quot;&gt;&lt;/iframe&gt;</html></example></function><function cat="Traversing" name="find" return="jQuery" timestamp="2007-10-26T02:35:13Z"><added>1.0</added><desc>Searches for all elements that match the specified <![CDATA[<a href='Selectors'>expression</a>]]>. This method is a good way to find additional descendant elements with which to process.</desc><longdesc>All searching is done using a <![CDATA[<a href='Selectors'>jQuery expression</a>]]>. The expression can be written using CSS 1-3 Selector syntax. </longdesc><params name="expr" type="String"><desc>An expression to search with.</desc></params><example><desc>Starts with all paragraphs and searches for descendant span elements, same as $(&quot;p span&quot;)</desc><code>$(&quot;p&quot;).find(&quot;span&quot;).css('color','red');</code><html>&lt;p&gt;&lt;span&gt;Hello&lt;/span&gt;, how are you?&lt;/p&gt;
  &lt;p&gt;Me? I'm &lt;span&gt;good&lt;/span&gt;.&lt;/p&gt;</html></example><example><desc>Add spans around each word then add a hover and italicize words with the letter '''t'''.</desc><code>
    var newText = $(&quot;p&quot;).text().split(&quot; &quot;).join(&quot;&lt;/span&gt; &lt;span&gt;&quot;);
    newText = &quot;&lt;span&gt;&quot; + newText + &quot;&lt;/span&gt;&quot;;

    $(&quot;p&quot;).html(newText)
          .find(&quot;span&quot;)
            .hover(function () { $(this).addClass(&quot;hilite&quot;); },
                   function () { $(this).removeClass(&quot;hilite&quot;); })
          .end()
          .find(&quot;:contains('t')&quot;)
            .css({&quot;font-style&quot;:&quot;italic&quot;, &quot;font-weight&quot;:&quot;bolder&quot;});
</code><css>
  p { font-size:20px; width:200px; cursor:default; 
      color:blue; font-weight:bold; margin:0 10px; }
  .hilite { background:yellow; }
  </css><html>&lt;p&gt;
    When the day is short
    find that which matters to you
    or stop believing
  &lt;/p&gt;</html></example></function><function cat="Traversing" name="next" return="jQuery" timestamp="2007-11-30T05:32:39Z"><added>1.0</added><desc>Get a set of elements containing the unique next siblings of each of the given set of elements.</desc><longdesc>next only returns the very next sibling for each element, not all next siblings (see nextAll).

You may provide an optional expression to filter the returned set. </longdesc><params name="expr" optional="true" type="String"><desc>An expression with which to filter the returned set.</desc></params><example><desc>Find the very next sibling of each disabled button and change its text &quot;this button is disabled&quot;.</desc><code>$(&quot;button[disabled]&quot;).next().text(&quot;this button is disabled&quot;);</code><css>
  span { color:blue; font-weight:bold; }
  button { width:100px; }
  </css><html>&lt;div&gt;&lt;button disabled=&quot;disabled&quot;&gt;First&lt;/button&gt; - &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;&lt;button&gt;Second&lt;/button&gt; - &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;&lt;button disabled=&quot;disabled&quot;&gt;Third&lt;/button&gt; - &lt;span&gt;&lt;/span&gt;&lt;/div&gt;</html></example><example><desc>Find the very next sibling of each paragraph that has a class &quot;selected&quot;.</desc><code>$(&quot;p&quot;).next(&quot;.selected&quot;).css(&quot;background&quot;, &quot;yellow&quot;);</code><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p class=&quot;selected&quot;&gt;Hello Again&lt;/p&gt;
  &lt;div&gt;&lt;span&gt;And Again&lt;/span&gt;&lt;/div&gt;</html></example></function><function cat="Traversing" name="nextAll" return="jQuery" timestamp="2007-10-26T04:12:55Z"><added>1.2</added><desc>Find all sibling elements after the current element.</desc><longdesc>Use an optional expression to filter the matched set. </longdesc><params name="expr" optional="true" type="String"><desc>An expression to filter the next Elements with.</desc></params><example><desc>Locate all the divs after the first and give them a class.</desc><code>$(&quot;div:first&quot;).nextAll().addClass(&quot;after&quot;);</code><css>
  div { width: 80px; height: 80px; background: #abc; 
        border: 2px solid black; margin: 10px; float: left; }
  div.after { border-color: red; }
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example><example><desc>Locate all the paragraphs after the second child in the body and give them a class.</desc><code>
    $(&quot;:nth-child(1)&quot;).nextAll(&quot;p&quot;).addClass(&quot;after&quot;);
</code><css>
  div, p { width: 60px; height: 60px; background: #abc;
           border: 2px solid black; margin: 10px; float: left; }
  .after { border-color: red; }
  </css><html>&lt;p&gt;p&lt;/p&gt;
  &lt;div&gt;div&lt;/div&gt;
  &lt;p&gt;p&lt;/p&gt;
  &lt;p&gt;p&lt;/p&gt;
  &lt;div&gt;div&lt;/div&gt;
  &lt;p&gt;p&lt;/p&gt;
  &lt;div&gt;div&lt;/div&gt;</html></example></function><function cat="Traversing" name="parent" return="jQuery" timestamp="2007-10-26T06:13:44Z"><added>1.0</added><desc>Get a set of elements containing the unique parents of the matched set of elements.</desc><longdesc>You may use an optional expression to filter the set of parent elements that will match. </longdesc><params name="expr" optional="true" type="String"><desc>An expression to filter the parents with.</desc></params><example><desc>Shows the parent of each element as (parent &gt; child).  Check the View Source to see the raw html.</desc><code>
    $(&quot;*&quot;, document.body).each(function () {
      var parentTag = $(this).parent().get(0).tagName;
      $(this).prepend(document.createTextNode(parentTag + &quot; &gt; &quot;));
    });
</code><css>
  div,p { margin:10px; }
  </css><html>&lt;div&gt;div, 
    &lt;span&gt;span, &lt;/span&gt;
    &lt;b&gt;b &lt;/b&gt;
  &lt;/div&gt;
  &lt;p&gt;p, 
    &lt;span&gt;span, 
      &lt;em&gt;em &lt;/em&gt;
    &lt;/span&gt;
  &lt;/p&gt;
  &lt;div&gt;div, 
    &lt;strong&gt;strong, 
      &lt;span&gt;span, &lt;/span&gt;
      &lt