<?xml version="1.0" ?>
<docs version="1.2.6" startdoc="API" timestamp="2008-06-03T15:40:58Z">

<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method><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>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<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><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><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><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><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><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><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><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><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>

<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>

<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method 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;em&gt;em, 
        &lt;b&gt;b, &lt;/b&gt;
      &lt;/em&gt;
    &lt;/strong&gt;
    &lt;b&gt;b &lt;/b&gt;

  &lt;/div&gt;</html></example><example><desc>Find the parent element of each paragraph with a class &quot;selected&quot;.</desc><code>$(&quot;p&quot;).parent(&quot;.selected&quot;).css(&quot;background&quot;, &quot;yellow&quot;);</code><html>&lt;div&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;/div&gt;

  &lt;div class=&quot;selected&quot;&gt;&lt;p&gt;Hello Again&lt;/p&gt;&lt;/div&gt;
</html></example></method>
<method cat="Traversing" name="parents" return="jQuery" timestamp="2007-10-26T08:08:17Z"><added>1.0</added><desc>Get a set of elements containing the unique ancestors of the matched set of elements (except for the root element).

The matched elements can be filtered with an optional expression. </desc><longdesc></longdesc><params name="expr" optional="true" type="String"><desc>An expression to filter the ancestors with</desc></params><example><desc>Find all parent elements of each span.</desc><code>
    var parentEls = $(&quot;b&quot;).parents()
                          .map(function () { 
                                return this.tagName; 
                              })
                          .get().join(&quot;, &quot;);
    $(&quot;b&quot;).append(&quot;&lt;strong&gt;&quot; + parentEls + &quot;&lt;/strong&gt;&quot;);

</code><css>
  b { color:blue; }
  strong { color:red; }
  </css><html>&lt;div&gt;
    &lt;p&gt;
      &lt;span&gt;
        &lt;b&gt;My parents are: &lt;/b&gt;
      &lt;/span&gt;

    &lt;/p&gt;
  &lt;/div&gt;</html></example><example><desc>Click to find all unique div parent elements of each span.</desc><code>
    function showParents() {
      $(&quot;div&quot;).css(&quot;border-color&quot;, &quot;white&quot;);
      var len = $(&quot;span.selected&quot;)
                       .parents(&quot;div&quot;)
                       .css(&quot;border&quot;, &quot;2px red solid&quot;)
                       .length;
      $(&quot;b&quot;).text(&quot;Unique div parents: &quot; + len);
    }
    $(&quot;span&quot;).click(function () {
      $(this).toggleClass(&quot;selected&quot;);
      showParents();
    });

</code><css>
  p, div, span {margin:2px; padding:1px; }
  div { border:2px white solid; }
  span { cursor:pointer; font-size:12px; }
  .selected { color:blue; }
  b { color:red; display:block; font-size:14px; }
  </css><html>&lt;p&gt;
    &lt;div&gt;
      &lt;div&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/div&gt;
      &lt;span&gt;Hello Again&lt;/span&gt;

    &lt;/div&gt;
    &lt;div&gt;
      &lt;span&gt;And Hello Again&lt;/span&gt;
    &lt;/div&gt;
  &lt;/p&gt;

  &lt;b&gt;Click Hellos to toggle their parents.&lt;/b&gt;</html></example></method>
<method cat="Traversing" name="prev" return="jQuery" timestamp="2007-10-26T08:24:19Z"><added>1.0</added><desc>Get a set of elements containing the unique previous siblings of each of the matched set of elements.</desc><longdesc>Use an optional expression to filter the matched set.

Only the immediately previous sibling is returned, not all previous siblings. </longdesc><params name="expr" optional="true" type="String"><desc>An expression to filter the previous Elements with.</desc></params><example><desc>Find the very previous sibling of each div.</desc><code>
    var $curr = $(&quot;#start&quot;);
    $curr.css(&quot;background&quot;, &quot;#f99&quot;);
    $(&quot;button&quot;).click(function () {
      $curr = $curr.prev();
      $(&quot;div&quot;).css(&quot;background&quot;, &quot;&quot;);
      $curr.css(&quot;background&quot;, &quot;#f99&quot;);
    });

</code><css>
  div { width:40px; height:40px; margin:10px;
        float:left; border:2px blue solid; 
        padding:2px; }
  span { font-size:14px; }
  p { clear:left; margin:10px; }
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;span&gt;has child&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 id=&quot;start&quot;&gt;&lt;/div&gt;

  &lt;div&gt;&lt;/div&gt;
  &lt;p&gt;&lt;button&gt;Go to Prev&lt;/button&gt;&lt;/p&gt;</html></example><example><desc>Find the very previous sibling of each paragraph that has a class &quot;selected&quot;.</desc><code>$(&quot;p&quot;).prev(&quot;.selected&quot;).css(&quot;background&quot;, &quot;yellow&quot;);</code><html>&lt;div&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/div&gt;

  &lt;p class=&quot;selected&quot;&gt;Hello Again&lt;/p&gt;
  &lt;p&gt;And Again&lt;/p&gt;</html></example></method>
<method cat="Traversing" name="prevAll" return="jQuery" timestamp="2007-10-26T08:32:33Z"><added>1.2</added><desc>Find all sibling elements before 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 previous Elements with.</desc></params><example><desc>Locate all the divs before the last and give them a class.</desc><code>$(&quot;div:last&quot;).prevAll().addClass(&quot;before&quot;);</code><css>

  div { width:70px; height:70px; background:#abc; 
        border:2px solid black; margin:10px; float:left; }
  div.before { 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></method>
<method cat="Traversing" name="siblings" return="jQuery" timestamp="2007-10-26T09:21:57Z"><added>1.0</added><desc>Get a set of elements containing all of the unique siblings of each of the matched set of elements.

Can be filtered with an optional expressions. </desc><longdesc></longdesc><params name="expr" optional="true" type="String"><desc>An expression to filter the sibling Elements with</desc></params><example><desc>Find the unique siblings of all yellow li elements in the 3 lists (including other yellow li elements if appropriate).</desc><code>

    var len = $(&quot;.hilite&quot;).siblings()
                          .css(&quot;color&quot;, &quot;red&quot;)
                          .length;
    $(&quot;b&quot;).text(len);
</code><css>
  ul { float:left; margin:5px; font-size:16px; font-weight:bold; }
  p { color:blue; margin:10px 20px; font-size:16px; padding:5px; 
      font-weight:bolder; }
  .hilite { background:yellow; }
</css><html>&lt;ul&gt;
    &lt;li&gt;One&lt;/li&gt;

    &lt;li&gt;Two&lt;/li&gt;
    &lt;li class=&quot;hilite&quot;&gt;Three&lt;/li&gt;
    &lt;li&gt;Four&lt;/li&gt;
  &lt;/ul&gt;

  &lt;ul&gt;
    &lt;li&gt;Five&lt;/li&gt;
    &lt;li&gt;Six&lt;/li&gt;
    &lt;li&gt;Seven&lt;/li&gt;

  &lt;/ul&gt;
  &lt;ul&gt;
    &lt;li&gt;Eight&lt;/li&gt;
    &lt;li class=&quot;hilite&quot;&gt;Nine&lt;/li&gt;

    &lt;li&gt;Ten&lt;/li&gt;
    &lt;li class=&quot;hilite&quot;&gt;Eleven&lt;/li&gt;
  &lt;/ul&gt;
  &lt;p&gt;Unique siblings: &lt;b&gt;&lt;/b&gt;&lt;/p&gt;</html></example><example><desc>Find all siblings with a class &quot;selected&quot; of each div.</desc><code>$(&quot;p&quot;).siblings(&quot;.selected&quot;).css(&quot;background&quot;, &quot;yellow&quot;);</code><html>&lt;div&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/div&gt;

  &lt;p class=&quot;selected&quot;&gt;Hello Again&lt;/p&gt;
  &lt;p&gt;And Again&lt;/p&gt;</html></example></method>
<method cat="Traversing" name="andSelf" return="jQuery" timestamp="2007-10-26T09:28:46Z"><added>1.2</added><desc>Add the previous selection to the current selection.</desc><longdesc>Useful for traversing elements, and then adding something that was matched before the last traversion.</longdesc><example><desc>Find all divs, and all the paragraphs inside of them, and give them both classnames.  Notice the div doesn't have the yellow background color since it didn't use andSelf().</desc><code>
    $(&quot;div&quot;).find(&quot;p&quot;).andSelf().addClass(&quot;border&quot;);
    $(&quot;div&quot;).find(&quot;p&quot;).addClass(&quot;background&quot;);

</code><css>
  p, div { margin:5px; padding:5px; }
  .border { border: 2px solid red; }
  .background { background:yellow; }
  </css><html>&lt;div&gt;
    &lt;p&gt;First Paragraph&lt;/p&gt;
    &lt;p&gt;Second Paragraph&lt;/p&gt;
  &lt;/div&gt;</html></example></method>
<method cat="Traversing" name="end" return="jQuery" timestamp="2007-10-26T10:50:16Z"><added>1.0</added><desc>Revert the most recent 'destructive' operation, changing the set of matched elements to its previous state (right before the destructive operation).</desc><longdesc>If there was no destructive operation before, an empty set is returned.

A 'destructive' operation is any operation that changes the set of matched jQuery elements, which means any Traversing function that returns a jQuery object - including <![CDATA[<a href='Traversing/add'>add</a>]]>, <![CDATA[<a href='Traversing/andSelf'>andSelf</a>]]>, <![CDATA[<a href='Traversing/children'>children</a>]]>, <![CDATA[<a href='Traversing/filter'>filter</a>]]>, <![CDATA[<a href='Traversing/find'>find</a>]]>, <![CDATA[<a href='Traversing/map'>map</a>]]>, <![CDATA[<a href='Traversing/next'>next</a>]]>, <![CDATA[<a href='Traversing/nextAll'>nextAll</a>]]>, <![CDATA[<a href='Traversing/not'>not</a>]]>, <![CDATA[<a href='Traversing/parent'>parent</a>]]>, <![CDATA[<a href='Traversing/parents'>parents</a>]]>, <![CDATA[<a href='Traversing/prev'>prev</a>]]>, <![CDATA[<a href='Traversing/prevAll'>prevAll</a>]]>, <![CDATA[<a href='Traversing/siblings'>siblings</a>]]> and <![CDATA[<a href='Traversing/slice'>slice</a>]]> - plus the <![CDATA[<a href='Manipulation/clone'>clone</a>]]> function (from Manipulation). </longdesc><example><desc>Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs.</desc><code>

    jQuery.fn.showTags = function (n) {
      var tags = this.map(function () { 
                              return this.tagName; 
                            })
                        .get().join(&quot;, &quot;);
      $(&quot;b:eq(&quot; + n + &quot;)&quot;).text(tags);
      return this;
    };

    $(&quot;p&quot;).showTags(0)
          .find(&quot;span&quot;)
          .showTags(1)
          .css(&quot;background&quot;, &quot;yellow&quot;)
          .end()
          .showTags(2)
          .css(&quot;font-style&quot;, &quot;italic&quot;);

</code><css>
  p, div { margin:1px; padding:1px; font-weight:bold; 
           font-size:16px; }
  div { color:blue; }
  b { color:red; }
  </css><html>&lt;p&gt;
    Hi there &lt;span&gt;how&lt;/span&gt; are you &lt;span&gt;doing&lt;/span&gt;?
  &lt;/p&gt;

  &lt;p&gt;
    This &lt;span&gt;span&lt;/span&gt; is one of 
    several &lt;span&gt;spans&lt;/span&gt; in this
    &lt;span&gt;sentence&lt;/span&gt;.
  &lt;/p&gt;

  &lt;div&gt;
    Tags in jQuery object initially: &lt;b&gt;&lt;/b&gt;
  &lt;/div&gt;
  &lt;div&gt;
    Tags in jQuery object after find: &lt;b&gt;&lt;/b&gt;

  &lt;/div&gt;
  &lt;div&gt;
    Tags in jQuery object after end: &lt;b&gt;&lt;/b&gt;
  &lt;/div&gt;</html></example><example><desc>Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs.</desc><code>$(&quot;p&quot;).find(&quot;span&quot;).end().css(&quot;border&quot;, &quot;2px red solid&quot;);</code><css>p { margin:10px; padding:10px; }</css><html>&lt;p&gt;&lt;span&gt;Hello&lt;/span&gt;, how are you?&lt;/p&gt;</html></example></method>

<method 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></method>
<method 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></method>
<method 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></method>
<method 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></method>
<method cat="Manipulation" name="append" return="jQuery" timestamp="2007-10-26T11:35:40Z"><added>1.0</added><desc>Append content to the inside of every matched element.</desc><longdesc>This operation is similar to doing an appendChild to all the specified elements, adding them into the document.</longdesc><params name="content" type="String, Element, jQuery"><desc>Content to append to the target.</desc></params><example><desc>Appends some HTML to all paragraphs.</desc><code>$(&quot;p&quot;).append(&quot;&lt;b&gt;Hello&lt;/b&gt;&quot;);</code><css>p { background:yellow; }</css><html>&lt;p&gt;I would like to say: &lt;/p&gt;</html></example><example><desc>Appends an Element to all paragraphs.</desc><code>$(&quot;p&quot;).append(document.createTextNode(&quot;Hello&quot;));</code><css>p { background:yellow; }</css><html>&lt;p&gt;I would like to say: &lt;/p&gt;</html></example><example><desc>Appends a jQuery object (similar to an Array of DOM Elements) to all paragraphs.</desc><code>$(&quot;p&quot;).append( $(&quot;b&quot;) );</code><css>p { background:yellow; }</css><html>&lt;b&gt;Hello&lt;/b&gt;&lt;p&gt;I would like to say: &lt;/p&gt;</html></example></method>
<method cat="Manipulation" name="appendTo" return="jQuery" timestamp="2007-10-26T11:57:38Z"><added>1.0</added><desc>Append all of the matched elements to another, specified, set of elements.</desc><longdesc>This operation is, essentially, the reverse of doing a regular $(A).append(B), in that instead of appending B to A, you're appending A to B.</longdesc><params name="content" type="String"><desc>target to which the content will be appended.</desc></params><example><desc>Appends all spans to the element with the ID &quot;foo&quot;</desc><code>$(&quot;span&quot;).appendTo(&quot;#foo&quot;); // check append() examples</code><css>#foo { background:yellow; }</css><html>&lt;span&gt;I have nothing more to say... &lt;/span&gt;

  &lt;div id=&quot;foo&quot;&gt;FOO! &lt;/div&gt;</html></example></method>
<method cat="Manipulation" name="prepend" return="jQuery" timestamp="2007-10-26T12:07:02Z"><added>1.0</added><desc>Prepend content to the inside of every matched element.</desc><longdesc>This operation is the best way to insert elements inside, at the beginning, of all matched elements.</longdesc><params name="content" type="String, Element, jQuery"><desc>Content to prepend to the target.</desc></params><example><desc>Prepends some HTML to all paragraphs.</desc><code>$(&quot;p&quot;).prepend(&quot;&lt;b&gt;Hello &lt;/b&gt;&quot;);</code><css>p { background:yellow; }</css><html>&lt;p&gt;there friend!&lt;/p&gt;

  &lt;p&gt;amigo!&lt;/p&gt;</html></example><example><desc>Prepends a DOM Element to all paragraphs.</desc><code>$(&quot;p&quot;).prepend(document.createTextNode(&quot;Hello &quot;));</code><css>p { background:yellow; }</css><html>&lt;p&gt;is what I'd say&lt;/p&gt;
  &lt;p&gt;is what I said&lt;/p&gt;</html></example><example><desc>Prepends a jQuery object (similar to an Array of DOM Elements) to all paragraphs.</desc><code>$(&quot;p&quot;).prepend( $(&quot;b&quot;) );</code><css>p { background:yellow; }</css><html>&lt;p&gt; is what was said.&lt;/p&gt;&lt;b&gt;Hello&lt;/b&gt;</html></example></method>
<method cat="Manipulation" name="prependTo" return="jQuery" timestamp="2007-10-26T12:00:39Z"><added>1.0</added><desc>Prepend all of the matched elements to another, specified, set of elements.</desc><longdesc>This operation is, essentially, the reverse of doing a regular $(A).prepend(B), in that instead of prepending B to A, you're prepending A to B.</longdesc><params name="content" type="String"><desc>target to which the content will be prepended.</desc></params><example><desc>Prepends all spans to the element with the ID &quot;foo&quot;</desc><css>div { background:yellow; }</css><code>$(&quot;span&quot;).prependTo(&quot;#foo&quot;); // check prepend() examples</code><html>&lt;div id=&quot;foo&quot;&gt;FOO!&lt;/div&gt;

  &lt;span&gt;I have something to say... &lt;/span&gt;</html></example></method>
<method cat="Manipulation" name="after" return="jQuery" timestamp="2008-05-22T20:56:00Z"><added>1.0</added><desc>Insert content after each of the matched elements.</desc><longdesc></longdesc><params name="content" type="String, Element, jQuery"><desc>Content to insert after each target.</desc></params><example><desc>Inserts some HTML after all paragraphs.</desc><code>$(&quot;p&quot;).after(&quot;&lt;b&gt;Hello&lt;/b&gt;&quot;);</code><css>p { background:yellow; }</css><html>&lt;p&gt;I would like to say: &lt;/p&gt;</html></example><example><desc>Inserts a DOM element after all paragraphs.</desc><code>$(&quot;p&quot;).after( document.createTextNode(&quot;Hello&quot;) );</code><css>p { background:yellow; }</css><html>&lt;p&gt;I would like to say: &lt;/p&gt;</html></example><example><desc>Inserts a jQuery object (similar to an Array of DOM Elements) after all paragraphs.</desc><code>$(&quot;p&quot;).after( $(&quot;b&quot;) );</code><css>p { background:yellow; }</css><html>&lt;b&gt;Hello&lt;/b&gt;

  &lt;p&gt;I would like to say: &lt;/p&gt;</html></example></method>
<method cat="Manipulation" name="before" return="jQuery" timestamp="2007-10-27T02:02:04Z"><added>1.0</added><desc>Insert content before each of the matched elements.</desc><longdesc></longdesc><params name="content" type="String, Element, jQuery"><desc>Content to insert before each target.</desc></params><example><desc>Inserts some HTML before all paragraphs.</desc><code>$(&quot;p&quot;).before(&quot;&lt;b&gt;Hello&lt;/b&gt;&quot;);</code><css>p { background:yellow; }</css><html>&lt;p&gt; is what I said...&lt;/p&gt;</html></example><example><desc>Inserts a DOM element before all paragraphs.</desc><code>$(&quot;p&quot;).before( document.createTextNode(&quot;Hello&quot;) );</code><css>p { background:yellow; }</css><html>&lt;p&gt; is what I said...&lt;/p&gt;</html></example><example><desc>Inserts a jQuery object (similar to an Array of DOM Elements) before all paragraphs.</desc><code>$(&quot;p&quot;).before( $(&quot;b&quot;) );</code><css>p { background:yellow; }</css><html>&lt;p&gt; is what I said...&lt;/p&gt;&lt;b&gt;Hello&lt;/b&gt;</html></example></method>
<method cat="Manipulation" name="insertAfter" return="jQuery" timestamp="2007-10-27T02:13:19Z"><added>1.0</added><desc>Insert all of the matched elements after another, specified, set of elements.</desc><longdesc>This operation is, essentially, the reverse of doing a regular $(A).after(B), in that instead of inserting B after A, you're inserting A after B.</longdesc><params name="content" type="String"><desc>Content after which the selected element(s) is inserted.</desc></params><example><desc>Inserts all paragraphs after an element with id of &quot;foo&quot;. Same as $(&quot;#foo&quot;).after(&quot;p&quot;)</desc><code>$(&quot;p&quot;).insertAfter(&quot;#foo&quot;); // check after() examples</code><css>#foo { background:yellow; }</css><html>&lt;p&gt; is what I said... &lt;/p&gt;&lt;div id=&quot;foo&quot;&gt;FOO!&lt;/div&gt;</html></example></method>
<method cat="Manipulation" name="insertBefore" return="jQuery" timestamp="2007-10-27T02:16:13Z"><added>1.0</added><desc>Insert all of the matched elements before another, specified, set of elements.</desc><longdesc>This operation is, essentially, the reverse of doing a regular $(A).before(B), in that instead of inserting B before A, you're inserting A before B.</longdesc><params name="content" type="String"><desc>Content after which the selected element(s) is inserted.</desc></params><example><desc>Inserts all paragraphs before an element with id of &quot;foo&quot;. Same as $(&quot;#foo&quot;).before(&quot;p&quot;)</desc><code>$(&quot;p&quot;).insertBefore(&quot;#foo&quot;); // check before() examples</code><css>#foo { background:yellow; }</css><html>&lt;div id=&quot;foo&quot;&gt;FOO!&lt;/div&gt;&lt;p&gt;I would like to say: &lt;/p&gt;</html></example></method>
<method cat="Manipulation" name="wrap" return="jQuery" timestamp="2008-05-26T20:16:10Z"><desc>Wrap each matched element with the specified HTML content.</desc><longdesc>This wrapping process is most useful for injecting additional structure into a document, without ruining the original semantic qualities of a document.

This works by going through the first element provided (which is generated, on the fly, from the provided HTML) and finds the deepest ancestor element within its structure -- it is that element that will enwrap everything else.</longdesc><params name="html" type="String"><desc>A string of HTML that will be created on the fly and wrapped around each target.</desc></params><example><desc>Wrap a new div around all of the paragraphs.</desc><code>$(&quot;p&quot;).wrap(&quot;&lt;div&gt;&lt;/div&gt;&quot;);</code><css>

  div { border: 2px solid blue; }
  p { background:yellow; margin:4px; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;</html></example><example><desc>Wraps a newly created tree of objects around the spans.  Notice anything in between the spans gets left out like the &lt;strong&gt; (red text) in this example.  Even the white space between spans is left out.  Click View Source to see the original html.</desc><code>$(&quot;span&quot;).wrap(&quot;&lt;div&gt;&lt;div&gt;&lt;p&gt;&lt;em&gt;&lt;b&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&quot;);</code><css>

  div { border:2px blue solid; margin:2px; padding:2px; }
  p { background:yellow; margin:2px; padding:2px; }
  strong { color:red; }
  </css><html>&lt;span&gt;Span Text&lt;/span&gt;
  &lt;strong&gt;What about me?&lt;/strong&gt;
  &lt;span&gt;Another One&lt;/span&gt;</html></example></method>
<method cat="Manipulation" name="wrap" return="jQuery" timestamp="2008-05-26T20:16:10Z"><added>1.0</added><desc>Wrap each matched element with the specified element.</desc><longdesc></longdesc><params name="elem" type="Element"><desc>A DOM element that will be wrapped around each target.</desc></params><example><desc>Wrap a new div around all of the paragraphs.</desc><code>$(&quot;p&quot;).wrap(document.createElement(&quot;div&quot;));</code><css>

  div { border: 2px solid blue; }
  p { background:yellow; margin:4px; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;</html></example><example><desc>Wrap a jQuery object double depth div around all of the paragraphs.  Notice it doesn't move the object but just clones it to wrap around its target.</desc><code>$(&quot;p&quot;).wrap($(&quot;.doublediv&quot;));</code><css>

  div { border: 2px solid blue; margin:2px; padding:2px; }
  .doublediv { border-color:red; }
  p { background:yellow; margin:4px; font-size:14px; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;
  &lt;div class=&quot;doublediv&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;</html></example></method>
<method cat="Manipulation" name="wrapAll" return="jQuery" timestamp="2007-10-27T04:26:57Z"><added>1.2</added><desc>Wrap all the elements in the matched set into a single wrapper element.</desc><longdesc>This is different from <![CDATA[<a href='Manipulation/wrap'>.wrap()</a>]]> where each element in the matched set would get wrapped with an element.

This wrapping process is most useful for injecting additional structure into a document, without ruining the original semantic qualities of a document.

This works by going through the first element provided (which is generated, on the fly, from the provided HTML) and finds the deepest ancestor element within its structure -- it is that element that will enwrap everything else.</longdesc><params name="html" type="String"><desc>A string of HTML that will be created on the fly and wrapped around the target.</desc></params><example><desc>Wrap a new div around all of the paragraphs.</desc><code>$(&quot;p&quot;).wrapAll(&quot;&lt;div&gt;&lt;/div&gt;&quot;);</code><css>

  div { border: 2px solid blue; }
  p { background:yellow; margin:4px; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;</html></example><example><desc>Wraps a newly created tree of objects around the spans.  Notice anything in between the spans gets left out like the &lt;strong&gt; (red text) in this example.  Even the white space between spans is left out.  Click View Source to see the original html.</desc><code>$(&quot;span&quot;).wrapAll(&quot;&lt;div&gt;&lt;div&gt;&lt;p&gt;&lt;em&gt;&lt;b&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&quot;);</code><css>

  div { border:2px blue solid; margin:2px; padding:2px; }
  p { background:yellow; margin:2px; padding:2px; }
  strong { color:red; }
  </css><html>&lt;span&gt;Span Text&lt;/span&gt;
  &lt;strong&gt;What about me?&lt;/strong&gt;
  &lt;span&gt;Another One&lt;/span&gt;</html></example></method>
<method cat="Manipulation" name="wrapAll" return="jQuery" timestamp="2007-10-27T04:26:57Z"><added>1.2</added><desc>Wrap all the elements in the matched set into a single wrapper element.</desc><longdesc>This is different from <![CDATA[<a href='Manipulation/wrap'>.wrap()</a>]]> where each element in the matched set would get wrapped with an element.</longdesc><params name="elem" type="Element"><desc>A DOM element that will be wrapped around the target.</desc></params><example><desc>Wrap a new div around all of the paragraphs.</desc><code>$(&quot;p&quot;).wrapAll(document.createElement(&quot;div&quot;));</code><css>

  div { border: 2px solid blue; }
  p { background:yellow; margin:4px; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;</html></example><example><desc>Wrap a jQuery object double depth div around all of the paragraphs.  Notice it doesn't move the object but just clones it to wrap around its target.</desc><code>$(&quot;p&quot;).wrapAll($(&quot;.doublediv&quot;));</code><css>

  div { border: 2px solid blue; margin:2px; padding:2px; }
  .doublediv { border-color:red; }
  p { background:yellow; margin:4px; font-size:14px; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;
  &lt;div class=&quot;doublediv&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;</html></example></method>
<method cat="Manipulation" name="wrapInner" return="jQuery" timestamp="2007-10-27T04:43:16Z"><added>1.2</added><desc>Wrap the inner child contents of each matched element (including text nodes) with an HTML structure.</desc><longdesc>This wrapping process is most useful for injecting additional structure into a document, without ruining the original semantic qualities of a document.

This works by going through the first element provided (which is generated, on the fly, from the provided HTML) and finds the deepest ancestor element within its structure -- it is that element that will enwrap everything else.</longdesc><params name="html" type="String"><desc>A string of HTML that will be created on the fly and wrapped around the target.</desc></params><example><desc>Selects all paragraphs and wraps a bold tag around each of its contents.</desc><code>$(&quot;p&quot;).wrapInner(&quot;&lt;b&gt;&lt;/b&gt;&quot;);</code><css>p { background:#bbf; }</css><html>&lt;p&gt;Hello&lt;/p&gt;

  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;</html></example><example><desc>Wraps a newly created tree of objects around the inside of the body.</desc><code>$(&quot;body&quot;).wrapInner(&quot;&lt;div&gt;&lt;div&gt;&lt;p&gt;&lt;em&gt;&lt;b&gt;&lt;/b&gt;&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&quot;);</code><css>

  div { border:2px green solid; margin:2px; padding:2px; }
  p { background:yellow; margin:2px; padding:2px; }
  </css><html>Plain old text, or is it?</html></example></method>
<method cat="Manipulation" name="wrapInner" return="jQuery" timestamp="2007-10-27T04:43:16Z"><added>1.2</added><desc>Wrap the inner child contents of each matched element (including text nodes) with a DOM element.</desc><longdesc></longdesc><params name="elem" type="Element"><desc>A DOM element that will be wrapped around the target.</desc></params><example><desc>Selects all paragraphs and wraps a bold tag around each of its contents.</desc><code>$(&quot;p&quot;).wrapInner(document.createElement(&quot;b&quot;));</code><css>p { background:#9f9; }</css><html>&lt;p&gt;Hello&lt;/p&gt;

  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;</html></example><example><desc>Selects all paragraphs and wraps a jQuery object around each of its contents.</desc><code>$(&quot;p&quot;).wrapInner($(&quot;&lt;span class='red'&gt;&lt;/span&gt;&quot;));</code><css>

  p { background:#9f9; }
  .red { color:red; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;</html></example></method>
<method cat="Manipulation" name="replaceWith" return="jQuery" timestamp="2007-10-30T02:30:26Z"><added>1.2</added><desc>Replaces all matched elements with the specified HTML or DOM elements.</desc><longdesc></longdesc><params name="content" type="String, Element, jQuery"><desc>Content to replace the matched elements with.</desc></params><example><desc>On click, replace the button with a div containing the same word.</desc><code>

    $(&quot;button&quot;).click(function () {
      $(this).replaceWith(&quot;&lt;div&gt;&quot; + $(this).text() + &quot;&lt;/div&gt;&quot;);
    });
</code><css>
  button { display:block; margin:3px; color:red; width:200px; }
  div { color:red; border:2px solid blue; width:200px; 
        margin:3px; text-align:center; }
  </css><html>&lt;button&gt;First&lt;/button&gt;
  &lt;button&gt;Second&lt;/button&gt;

  &lt;button&gt;Third&lt;/button&gt;</html></example><example><desc>Replace all the paragraphs with bold words.</desc><code>$(&quot;p&quot;).replaceWith(&quot;&lt;b&gt;Paragraph. &lt;/b&gt;&quot;);</code><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;cruel&lt;/p&gt;

  &lt;p&gt;World&lt;/p&gt;</html></example><example><desc>Replace all the paragraphs with empty div elements.</desc><code>$(&quot;p&quot;).replaceWith(document.createElement(&quot;div&quot;));</code><css>
  div { border:2px solid blue; margin:3px; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;

  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;</html></example><example><desc>On click, replace each paragraph with a jQuery div object that is already in the DOM.  Notice it doesn't clone the object but rather moves it to replace the paragraph.</desc><code>
    $(&quot;p&quot;).click(function () {
      $(this).replaceWith($(&quot;div&quot;));
    });

</code><css>
  div { border:2px solid blue; color:red; margin:3px; }
  p { border:2px solid red; color:blue; margin:3px; cursor:pointer; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;

  &lt;div&gt;Replaced!&lt;/div&gt;</html></example></method>
<method cat="Manipulation" name="replaceAll" return="jQuery" timestamp="2007-10-30T02:37:23Z"><added>1.2</added><desc>Replaces the elements matched by the specified selector with the matched elements.</desc><longdesc>This function is the complement to replaceWith() which does the same task with the parameters reversed.</longdesc><params name="selector" type="Selector"><desc>The elements to find and replace the matched elements with.</desc></params><example><desc>Replace all the paragraphs with bold words.</desc><code>$(&quot;&lt;b&gt;Paragraph. &lt;/b&gt;&quot;).replaceAll(&quot;p&quot;); // check replaceWith() examples</code><html>&lt;p&gt;Hello&lt;/p&gt;

  &lt;p&gt;cruel&lt;/p&gt;
  &lt;p&gt;World&lt;/p&gt;</html></example></method>
<method cat="Manipulation" name="empty" return="jQuery" timestamp="2007-10-30T02:46:40Z"><added>1.0</added><desc>Remove all child nodes from the set of matched elements.</desc><longdesc>Note that this function starting with 1.2.2 will also remove all event handlers and internally cached data.</longdesc><example><desc>Removes all child nodes (including text nodes) from all paragraphs</desc><code>
    $(&quot;button&quot;).click(function () {
      $(&quot;p&quot;).empty();
    });

</code><css>
  p { background:yellow; }
  </css><html>&lt;p&gt;
    Hello, &lt;span&gt;Person&lt;/span&gt; &lt;a href=&quot;javascript:;&quot;&gt;and person&lt;/a&gt;
  &lt;/p&gt;

  &lt;button&gt;Call empty() on above paragraph&lt;/button&gt;</html></example></method>
<method cat="Manipulation" name="remove" return="jQuery" timestamp="2007-10-30T02:59:21Z"><added>1.0</added><desc>Removes all matched elements from the DOM. </desc><longdesc>This does NOT remove them from the jQuery object, allowing you to use the matched elements further.  Note that this function starting with 1.2.2 will also remove all event handlers and internally cached data.  So:

&lt;code&gt;
$(&quot;#foo&quot;).remove().appendTo(&quot;#bar&quot;);
&lt;/code&gt;

should be written as

&lt;code&gt;
$(&quot;#foo&quot;).appendTo(&quot;#bar&quot;);
&lt;/code&gt;

to avoid losing the event handlers.

Can be filtered with an optional expression.</longdesc><params name="expr" optional="true" type="String"><desc>A jQuery expression to filter the set of elements to be removed.</desc></params><example><desc>Removes all paragraphs from the DOM</desc><code>
    $(&quot;button&quot;).click(function () {
      $(&quot;p&quot;).remove();
    });

</code><css>p { background:yellow; margin:6px 0; }</css><html>&lt;p&gt;Hello&lt;/p&gt; 
  how are 
  &lt;p&gt;you?&lt;/p&gt;
  &lt;button&gt;Call remove() on paragraphs</html></example><example><desc>Removes all paragraphs that contain &quot;Hello&quot; from the DOM</desc><code>

    $(&quot;button&quot;).click(function () {
      $(&quot;p&quot;).remove(&quot;:contains('Hello')&quot;);
    });

</code><css>p { background:yellow; margin:6px 0; }</css><html>&lt;p class=&quot;hello&quot;&gt;Hello&lt;/p&gt;
  how are 
  &lt;p&gt;you?&lt;/p&gt;

  &lt;button&gt;Call remove(&quot;:contains('Hello')&quot;) on paragraphs</html></example></method>
<method cat="Manipulation" name="clone" return="jQuery" timestamp="2007-10-30T03:04:20Z"><added>1.0</added><desc>Clone matched DOM Elements and select the clones.</desc><longdesc>This is useful for moving copies of the elements to another location in the DOM.</longdesc><example><desc>Clones all b elements (and selects the clones) and prepends them to all paragraphs.</desc><code>$(&quot;b&quot;).clone().prependTo(&quot;p&quot;);</code><html>&lt;b&gt;Hello&lt;/b&gt;&lt;p&gt;, how are you?&lt;/p&gt;</html><results>&lt;b&gt;Hello&lt;/b&gt;&lt;p&gt;&lt;b&gt;Hello&lt;/b&gt;, how are you?&lt;/p&gt;</results></example></method>
<method cat="Manipulation" name="clone" return="jQuery" timestamp="2007-10-30T03:04:20Z"><added>1.0</added><desc>Clone matched DOM Elements, and all their event handlers, and select the clones.</desc><longdesc>This is useful for moving copies of the elements, and their events, to another location in the DOM.</longdesc><params name="true" type="Boolean"><desc>Set to true to enable cloning of event handlers.</desc></params><example><desc>Create a button that's able to clone itself - and have the clones themselves be clonable.</desc><code>

    $(&quot;button&quot;).click(function(){
      $(this).clone(true).insertAfter(this);
    });
</code><html>&lt;button&gt;Clone Me!&lt;/button&gt;</html></example></method>

<method cat="CSS" name="css" return="String" timestamp="2008-04-17T04:15:29Z"><added>1.0</added><desc>Return a style property on the first matched element.</desc><longdesc></longdesc><params name="name" type="String"><desc>The name of the property to access.</desc></params><example><desc>To access the background color of a clicked div.</desc><code>
    $(&quot;div&quot;).click(function () {
      var color = $(this).css(&quot;background-color&quot;);
      $(&quot;#result&quot;).html(&quot;That div is &lt;span style='color:&quot; +
                         color + &quot;;'&gt;&quot; + color + &quot;&lt;/span&gt;.&quot;);
    });

</code><css>
  div { width:60px; height:60px; margin:5px; float:left; }
  </css><html>&lt;span id=&quot;result&quot;&gt;&amp;nbsp;&lt;/span&gt;
  &lt;div style=&quot;background-color:blue;&quot;&gt;&lt;/div&gt;
  &lt;div style=&quot;background-color:rgb(15,99,30);&quot;&gt;&lt;/div&gt;

  &lt;div style=&quot;background-color:#123456;&quot;&gt;&lt;/div&gt;
  &lt;div style=&quot;background-color:#f11;&quot;&gt;&lt;/div&gt;</html></example></method>
<method cat="CSS" name="css" return="jQuery" timestamp="2008-04-17T04:15:29Z"><added>1.0</added><desc>Set a key/value object as style properties to all matched elements.</desc><longdesc>This is the best way to set several style properties on all matched elements.</longdesc><params name="properties" type="Map"><desc>Key/value pairs to set as style properties.</desc></params><example><desc>To set the color of all paragraphs to red and background to blue:</desc><code>
    $(&quot;p&quot;).hover(function () {
      $(this).css({ backgroundColor:&quot;yellow&quot;, fontWeight:&quot;bolder&quot; });
    }, function () {
      var cssObj = {
        backgroundColor: &quot;#ddd&quot;,
        fontWeight: &quot;&quot;,
        color: &quot;rgb(0,40,244)&quot;

      }
      $(this).css(cssObj);
    });
</code><css>
  p { color:green; }
  </css><html>&lt;p&gt;
    Move the mouse over a paragraph.
  &lt;/p&gt;
  &lt;p&gt;
    Like this one or the one above.
  &lt;/p&gt;</html></example><example><desc>If the property name includes a &quot;-&quot;, put it between quotation marks:</desc><code>

    $(&quot;p&quot;).hover(function () {
      $(this).css({ &quot;background-color&quot;:&quot;yellow&quot;, &quot;font-weight&quot;:&quot;bolder&quot; });
    }, function () {
      var cssObj = {
        &quot;background-color&quot;: &quot;#ddd&quot;,
        &quot;font-weight&quot;: &quot;&quot;,
        color: &quot;rgb(0,40,244)&quot;

      }
      $(this).css(cssObj);
    });
</code><css>
  p { color:green; }
  </css><html>&lt;p&gt;
    Move the mouse over a paragraph.
  &lt;/p&gt;
  &lt;p&gt;
    Like this one or the one above.
  &lt;/p&gt;</html></example></method>
<method cat="CSS" name="css" return="jQuery" timestamp="2008-04-17T04:15:29Z"><added>1.0</added><desc>Set a single style property to a value on all matched elements.</desc><longdesc>If a number is provided, it is automatically converted into a pixel value.</longdesc><params name="name" type="String"><desc>The name of the property to set.</desc></params><params name="value" type="String, Number"><desc>The value to set the property to.</desc></params><example><desc>To change the color of any paragraph to red on mouseover event.</desc><code>

    $(&quot;p&quot;).mouseover(function () {
      $(this).css(&quot;color&quot;,&quot;red&quot;);
    });
</code><css>
  p { color:blue; width:200px; font-size:14px; }
  </css><html>&lt;p&gt;
    Just roll the mouse over me.
  &lt;/p&gt;

  &lt;p&gt;
    Or me to see a color change.
  &lt;/p&gt;</html></example><example><desc>To highlight a clicked word in the paragraph.</desc><code>
    var words = $(&quot;p:first&quot;).text().split(&quot; &quot;);
    var text = words.join(&quot;&lt;/span&gt; &lt;span&gt;&quot;);
    $(&quot;p:first&quot;).html(&quot;&lt;span&gt;&quot; + text + &quot;&lt;/span&gt;&quot;);
    $(&quot;span&quot;).click(function () {
      $(this).css(&quot;background-color&quot;,&quot;yellow&quot;);
    });

</code><css>
  p { color:blue; font-weight:bold; cursor:pointer; }
  </css><html>&lt;p&gt;
    Once upon a time there was a man
    who lived in a pizza parlor. This
    man just loved pizza and ate it all 
    the time.  He went on to be the
    happiest man in the world.  The end.
  &lt;/p&gt;</html></example></method>
<method cat="CSS" name="offset" return="Object{top,left}" timestamp="2007-10-12T01:39:17Z"><added>1.2</added><desc>Get the current offset of the first matched element relative to the viewport.</desc><longdesc>The returned object contains two <![CDATA[<a href='Types#Integer'>Integer</a>]]> properties, top and left. The method works only with visible elements. </longdesc><example><desc>Access the offset of the second paragraph:</desc><code>var p = $(&quot;p:last&quot;);
var offset = p.offset();
p.html( &quot;left: &quot; + offset.left + &quot;, top: &quot; + offset.top );</code><css>

  p { margin-left:10px; }
  </css><html>&lt;p&gt;Hello&lt;/p&gt;&lt;p&gt;2nd Paragraph&lt;/p&gt;</html></example><example><desc>Click to see the offset.</desc><code>
    $(&quot;*&quot;, document.body).click(function (e) {
      var offset = $(this).offset();
      e.stopPropagation();
      $(&quot;#result&quot;).text(this.tagName + &quot; coords ( &quot; + offset.left + &quot;, &quot; +
                                      offset.top + &quot; )&quot;);
    });

</code><css>
  p { margin-left:10px; color:blue; width:200px; 
      cursor:pointer; }
  span { color:red; cursor:pointer; }
  div.abs { width:50px; height:50px; position:absolute;
            left:220px; top:35px; background-color:green; 
            cursor:pointer; }
  </css><html>&lt;div id=&quot;result&quot;&gt;Click an element.&lt;/div&gt;
  &lt;p&gt;
    This is the best way to &lt;span&gt;find&lt;/span&gt; an offset.
  &lt;/p&gt;

  &lt;div class=&quot;abs&quot;&gt;
  &lt;/dov&gt;
  </html></example></method>
<method cat="CSS" name="height" return="Integer" timestamp="2008-04-17T04:14:38Z"><added>1.0</added><desc>Get the current computed, pixel, height of the first matched element.</desc><longdesc>In jQuery 1.2, this method is able to find the height of the window and document.</longdesc><example><desc>Show various heights.  Note the values are from the iframe so might be smaller than you expected.  The yellow highlight shows the iframe body.</desc><code>
    function showHeight(ele, h) {
      $(&quot;div&quot;).text(&quot;The height for the &quot; + ele + 
                    &quot; is &quot; + h + &quot;px.&quot;);
    }
    $(&quot;#getp&quot;).click(function () { 
      showHeight(&quot;paragraph&quot;, $(&quot;p&quot;).height()); 
    });
    $(&quot;#getd&quot;).click(function () { 
      showHeight(&quot;document&quot;, $(document).height()); 
    });
    $(&quot;#getw&quot;).click(function () { 
      showHeight(&quot;window&quot;, $(window).height()); 
    });

</code><css>
  body { background:yellow; }
  button { font-size:12px; margin:2px; }
  p { width:150px; border:1px red solid; }
  div { color:red; font-weight:bold; }
  </css><html>&lt;button id=&quot;getp&quot;&gt;Get Paragraph Height&lt;/button&gt;
  &lt;button id=&quot;getd&quot;&gt;Get Document Height&lt;/button&gt;
  &lt;button id=&quot;getw&quot;&gt;Get Window Height&lt;/button&gt;

  &lt;div&gt;&amp;nbsp;&lt;/div&gt;
  &lt;p&gt;
    Sample paragraph to test height
  &lt;/p&gt;</html></example></method>
<method cat="CSS" name="height" return="jQuery" timestamp="2008-04-17T04:14:38Z"><added>1.0</added><desc>Set the CSS height of every matched element.</desc><longdesc>If no explicit unit was specified (like 'em' or '%') then &quot;px&quot; is concatenated to the value.</longdesc><params name="val" type="String, Number"><desc>Set the CSS 'height' property to the specified value.</desc></params><example><desc>To set the height of each div on click to 30px plus a color change.</desc><code>

    $(&quot;div&quot;).one('click', function () {
      $(this).height(30)
             .css({cursor:&quot;auto&quot;, backgroundColor:&quot;green&quot;});
    });
</code><css>
  div { width:50px; height:70px; float:left; margin:5px;
        background:rgb(255,140,0); cursor:pointer; }
  </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;</html></example></method>
<method cat="CSS" name="width" return="Integer" timestamp="2008-04-08T22:22:30Z"><added>1.0</added><desc>Get the current computed, pixel, width of the first matched element.</desc><longdesc>In jQuery 1.2, this method is able to find the width of the window and document.</longdesc><example><desc>Show various widths.  Note the values are from the iframe so might be smaller than you expected.  The yellow highlight shows the iframe body.</desc><code>
    function showWidth(ele, w) {
      $(&quot;div&quot;).text(&quot;The width for the &quot; + ele + 
                    &quot; is &quot; + w + &quot;px.&quot;);
    }
    $(&quot;#getp&quot;).click(function () { 
      showWidth(&quot;paragraph&quot;, $(&quot;p&quot;).width()); 
    });
    $(&quot;#getd&quot;).click(function () { 
      showWidth(&quot;document&quot;, $(document).width()); 
    });
    $(&quot;#getw&quot;).click(function () { 
      showWidth(&quot;window&quot;, $(window).width()); 
    });

</code><css>
  body { background:yellow; }
  button { font-size:12px; margin:2px; }
  p { width:150px; border:1px red solid; }
  div { color:red; font-weight:bold;  }
  </css><html>&lt;button id=&quot;getp&quot;&gt;Get Paragraph Width&lt;/button&gt;
  &lt;button id=&quot;getd&quot;&gt;Get Document Width&lt;/button&gt;
  &lt;button id=&quot;getw&quot;&gt;Get Window Width&lt;/button&gt;

  &lt;div&gt;&amp;nbsp;&lt;/div&gt;
  &lt;p&gt;
    Sample paragraph to test width
  &lt;/p&gt;</html></example></method>
<method cat="CSS" name="width" return="jQuery" timestamp="2008-04-08T22:22:30Z"><added>1.0</added><desc>Set the CSS width of every matched element.</desc><longdesc>If no explicit unit was specified (like 'em' or '%') then &quot;px&quot; is concatenated to the value.</longdesc><params name="val" type="String, Number"><desc>Set the CSS 'width' property to the specified value.</desc></params><example><desc>To set the width of each div on click to 30px plus a color change.</desc><code>

    $(&quot;div&quot;).one('click', function () {
      $(this).width(30)
             .css({cursor:&quot;auto&quot;, &quot;background-color&quot;:&quot;blue&quot;});
    });
</code><css>
  div { width:70px; height:50px; float:left; margin:5px;
        background:red; cursor:pointer; }
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;div&gt;d&lt;/div&gt;

  &lt;div&gt;d&lt;/div&gt;
  &lt;div&gt;d&lt;/div&gt;
  &lt;div&gt;d&lt;/div&gt;</html></example></method>

<method cat="Events" name="ready" return="jQuery" timestamp="2007-10-12T01:20:01Z"><desc>Binds a function to be executed whenever the DOM is ready to be traversed and manipulated.</desc><longdesc>&lt;p&gt;This is probably the most important function included in the event module, as it can greatly improve the response times of your web applications.&lt;/p&gt;&lt;p&gt;In a nutshell, this is a solid replacement for using window.onload, and attaching a function to that. By using this method, your bound function will be called the instant the DOM is ready to be read and manipulated, which is when what 99.99% of all JavaScript code needs to run.&lt;/p&gt;&lt;p&gt;There is one argument passed to the ready event handler: A reference to the jQuery function. You can name that argument whatever you like, and can therefore stick with the $ alias without risk of naming collisions.&lt;/p&gt;&lt;p&gt;Please ensure you have no code in your &lt;body&gt; onload event handler, otherwise $(document).ready() may not fire.&lt;/p&gt;&lt;p&gt;You can have as many $(document).ready events on your page as you like. The functions are then executed in the order they were added.&lt;/p&gt;</longdesc><params name="fn" type="Function"><desc>The function to be executed when the DOM is ready.

&lt;pre&gt;function callback(jQueryReference) {
  this; // document
}
&lt;/pre&gt;</desc></params><example><desc>Display a message when the DOM is loaded.</desc><code>$(&quot;p&quot;).text(&quot;The DOM is now loaded and can be manipulated.&quot;);</code><css>p { color:red; }</css><html>&lt;p&gt;
  &lt;/p&gt;</html></example><example><desc>To run code when the DOM loads, write:</desc><code>$(document).ready(function(){
  // Your code here...
});</code></example><example><desc>To use both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias, write:</desc><code>jQuery(function($) {
  // Your code using failsafe $ alias here...
});</code></example><example><desc>Commonly written as:</desc><code>$(function() {
  // Your code here...
});</code></example></method>
<method cat="Events" name="bind" return="jQuery" timestamp="2008-04-03T00:18:29Z"><added>1.0</added><desc>Binds a handler to one or more events (like click) for each matched element.  Can also bind custom events.</desc><longdesc>'''Possible event values:''' &lt;code&gt;blur&lt;/code&gt;, &lt;code&gt;focus&lt;/code&gt;, &lt;code&gt;load&lt;/code&gt;, &lt;code&gt;resize&lt;/code&gt;, &lt;code&gt;scroll&lt;/code&gt;, &lt;code&gt;unload&lt;/code&gt;, &lt;code&gt;click&lt;/code&gt;, &lt;code&gt;dblclick&lt;/code&gt;, &lt;code&gt; mousedown&lt;/code&gt;, &lt;code&gt;mouseup&lt;/code&gt;, &lt;code&gt;mousemove&lt;/code&gt;, &lt;code&gt;mouseover&lt;/code&gt;, &lt;code&gt;mouseout&lt;/code&gt;, &lt;code&gt;mouseenter&lt;/code&gt;, &lt;code&gt;mouseleave&lt;/code&gt;, &lt;code&gt;change&lt;/code&gt;, &lt;code&gt;select&lt;/code&gt;, &lt;code&gt; submit&lt;/code&gt;, &lt;code&gt;keydown&lt;/code&gt;, &lt;code&gt;keypress&lt;/code&gt;, &lt;code&gt;keyup&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;

The event handler is passed an event object that you can use to prevent default behaviour. To stop both default action and event bubbling, your handler has to return false. Note that this will prevent handlers on parent elements from running but not other jQuery handlers on the same element.

In most cases, you can define your event handlers as anonymous functions (see first example). In cases where that is not possible, you can pass additional data as the second parameter (and the handler function as the third), see second example.</longdesc><params name="type" type="String"><desc>One or more event types separated by a space</desc></params><params name="data" optional="true" type="Object"><desc>Additional data passed to the event handler as event.data</desc></params><params name="fn" type="Function"><desc>A function to bind to the event on each of the set of matched elements
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Handle click and double-click for the paragraph.  Note: the coordinates are window relative so in this case relative to the demo iframe.</desc><code>
    $(&quot;p&quot;).bind(&quot;click&quot;, function(e){
      var str = &quot;( &quot; + e.pageX + &quot;, &quot; + e.pageY + &quot; )&quot;;
      $(&quot;span&quot;).text(&quot;Click happened! &quot; + str);
    });
    $(&quot;p&quot;).bind(&quot;dblclick&quot;, function(){
      $(&quot;span&quot;).text(&quot;Double-click happened in &quot; + this.tagName);
    });
    $(&quot;p&quot;).bind(&quot;mouseenter mouseleave&quot;, function(e){
        $(this).toggleClass(&quot;over&quot;);
    });

</code><css>
  p { background:yellow; font-weight:bold; cursor:pointer; 
      padding:5px; }
  p.over { background: #ccc; }
  span { color:red; }
  </css><html>&lt;p&gt;Click or double click here.&lt;/p&gt;
  &lt;span&gt;&lt;/span&gt;</html></example><example><desc>To display each paragraph's text in an alert box whenever it is clicked:</desc><code>$(&quot;p&quot;).bind(&quot;click&quot;, function(){
  alert( $(this).text() );
});</code></example><example><desc>You can pass some extra data before the event handler:</desc><code>function handler(event) {
  alert(event.data.foo);
}
$(&quot;p&quot;).bind(&quot;click&quot;, {foo: &quot;bar&quot;}, handler)</code></example><example><desc>To cancel a default action and prevent it from bubbling up, return false:</desc><code>$(&quot;form&quot;).bind(&quot;submit&quot;, function() { return false; })</code></example><example><desc>To cancel only the default action by using the preventDefault method.</desc><code>$(&quot;form&quot;).bind(&quot;submit&quot;, function(event){
  event.preventDefault();
});</code></example><example><desc>Stop only an event from bubbling by using the stopPropagation method.</desc><code>$(&quot;form&quot;).bind(&quot;submit&quot;, function(event){
  event.stopPropagation();
});</code></example><example><desc>Can bind custom events too.</desc><code>

    $(&quot;p&quot;).bind(&quot;myCustomEvent&quot;, function(e, myName, myValue){
      $(this).text(myName + &quot;, hi there!&quot;);
      $(&quot;span&quot;).stop().css(&quot;opacity&quot;, 1)
               .text(&quot;myName = &quot; + myName)
               .fadeIn(30).fadeOut(1000);
    });
    $(&quot;button&quot;).click(function () {
      $(&quot;p&quot;).trigger(&quot;myCustomEvent&quot;, [ &quot;John&quot; ]);
    });

</code><css>
  p { color:red; }
  span { color:blue; }
  </css><html>&lt;p&gt;Has an attached custom event.&lt;/p&gt;
  &lt;button&gt;Trigger custom event&lt;/button&gt;
  &lt;span style=&quot;display:none;&quot;&gt;&lt;/span&gt;</html></example></method>
<method cat="Events" name="one" return="jQuery" timestamp="2008-03-02T01:08:57Z"><desc>Binds a handler to one or more events to be executed &lt;i&gt;once&lt;/i&gt; for each matched element.</desc><longdesc>&lt;p&gt;The handler is executed only once for each element. Otherwise, the same rules as described in <![CDATA[<a href='Events/bind'>bind</a>]]>() apply. The event handler is passed an event object that you can use to prevent default behaviour. To stop both default action and event bubbling, your handler should return false.&lt;/p&gt;&lt;p&gt;In most cases, you can define your event handlers as anonymous functions (see first example). In cases where that is not possible, you can pass additional data as the second paramter (and the handler function as the third), see second example.&lt;/p&gt;</longdesc><params name="type" type="String"><desc>An event type</desc></params><params name="data" optional="true" type="Object"><desc>Additional data passed to the event handler as event.data</desc></params><params name="fn" type="Function"><desc>A function to bind to the specified event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Tie a one-time click to each div.</desc><code>
    var n = 0;
    $(&quot;div&quot;).one(&quot;click&quot;, function(){
      var index = $(&quot;div&quot;).index(this);
      $(this).css({ borderStyle:&quot;inset&quot;,
                    cursor:&quot;auto&quot; });
      $(&quot;p&quot;).text(&quot;Div at index #&quot; + index + &quot; clicked.&quot; +
                  &quot;  That's &quot; + ++n + &quot; total clicks.&quot;);
    });

</code><css>
  div { width:60px; height:60px; margin:5px; float:left;
        background:green; border:10px outset; 
        cursor:pointer; }
  p { color:red; margin:0; clear:left; }
  </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;p&gt;Click a green square...&lt;/p&gt;</html></example><example><desc>To display the text of all paragraphs in an alert box the first time each of them is clicked:</desc><code>$(&quot;p&quot;).one(&quot;click&quot;, function(){
  alert( $(this).text() );
});</code></example></method>
<method cat="Events" name="trigger" return="jQuery" timestamp="2008-05-04T02:54:56Z"><desc>Trigger a type of event on every matched element.</desc><longdesc>&lt;p&gt;This will also cause the default action of the browser with the same name (if one exists) to be executed. For example, passing 'submit' to the trigger() function will also cause the browser to submit the form. This default action can be prevented by returning false from one of the functions bound to the event.&lt;/p&gt;&lt;p&gt;If a native event is triggered and a suitable event object is not passed as the first element of 'data', then a fake event object is added before all supplied 'data' arguments.  This element contains appropriate 'type' and 'target' fields and null-op 'preventDefault' and 'stopPropagation' methods, but none of the clientXY/pageXY/keyCode fields specific to mouse and keyboard events.  A &quot;suitable&quot; event object is judged by the presence of the 'preventDefault' field.&lt;/p&gt;&lt;p&gt;You can also trigger custom events registered with bind.&lt;/p&gt;</longdesc><params name="type " type="String"><desc>An event type to trigger.</desc></params><params name="data " optional="true" type="Array"><desc>Additional data to pass as arguments (after the event object) to the event handler.</desc></params><example><desc>Clicks to button #2 also trigger a click for button #1.</desc><code>

    $(&quot;button:first&quot;).click(function () {
      update($(&quot;span:first&quot;));
    });
    $(&quot;button:last&quot;).click(function () {
      $(&quot;button:first&quot;).trigger('click');

      update($(&quot;span:last&quot;));
    });

    function update(j) {
      var n = parseInt(j.text(), 0);
      j.text(n + 1);
    }
</code><css>
  button { margin:10px; }
  div { color:blue; font-weight:bold; }
  span { color:red; }
  </css><html>&lt;button&gt;Button #1&lt;/button&gt;

  &lt;button&gt;Button #2&lt;/button&gt;
  &lt;div&gt;&lt;span&gt;0&lt;/span&gt; button #1 clicks.&lt;/div&gt;
  &lt;div&gt;&lt;span&gt;0&lt;/span&gt; button #2 clicks.&lt;/div&gt;</html></example><example><desc>To submit the first form without using the submit() function, try:</desc><code>$(&quot;form:first&quot;).trigger(&quot;submit&quot;)</code></example><example><desc>To pass arbitrary data to an event:</desc><code>$(&quot;p&quot;).click( function (event, a, b) {
  // when a normal click fires, a and b are undefined
  // for a trigger like below a refers too &quot;foo&quot; and b refers to &quot;bar&quot;

} ).trigger(&quot;click&quot;, [&quot;foo&quot;, &quot;bar&quot;]);</code></example><example><desc>This would display a &quot;Hello World!&quot; alert box.</desc><code>$(&quot;p&quot;).bind(&quot;myEvent&quot;, function (event, message1, message2) {
  alert(message1 + ' ' + message2);
});
$(&quot;p&quot;).trigger(&quot;myEvent&quot;, [&quot;Hello&quot;,&quot;World!&quot;]);</code></example></method>
<method cat="Events" name="triggerHandler" return="jQuery" timestamp="2008-05-04T02:49:07Z"><released>1.2</released><desc>This particular method triggers all bound event handlers on an element (for a specific event type) WITHOUT executing the browsers default actions.</desc><longdesc>The event is only triggered on the first element within the JQuery collection.  Also, if the JQuery collection is empty, this method returns 'undefined' instead of an empty JQuery collection.</longdesc><params name="type " type="String"><desc>An event type to trigger.</desc></params><params name="data " optional="true" type="Array"><desc>Additional data to pass as arguments (after the event object) to the event handler.</desc></params><example><desc>If you called .triggerHandler() on a focus event - the browsers default focus action would not be triggered, only the event handlers bound to the focus event.</desc><code>

    $(&quot;#old&quot;).click(function(){
      $(&quot;input&quot;).trigger(&quot;focus&quot;);
    });
    $(&quot;#new&quot;).click(function(){
      $(&quot;input&quot;).triggerHandler(&quot;focus&quot;);
    });
    $(&quot;input&quot;).focus(function(){
      $(&quot;&lt;span&gt;Focused!&lt;/span&gt;&quot;).appendTo(&quot;body&quot;).fadeOut(1000);
    });

</code><html>&lt;button id=&quot;old&quot;&gt;.trigger(&quot;focus&quot;)&lt;/button&gt;
  &lt;button id=&quot;new&quot;&gt;.triggerHandler(&quot;focus&quot;)&lt;/button&gt;&lt;br/&gt;&lt;br/&gt;

  &lt;input type=&quot;text&quot; value=&quot;To Be Focused&quot;/&gt;</html></example></method>
<method cat="Events" name="unbind" return="jQuery" timestamp="2007-10-12T00:56:59Z"><desc>This does the opposite of bind, it removes bound events from each of the matched elements.</desc><longdesc>&lt;p&gt;Without any arguments, all bound events are removed.&lt;/p&gt;&lt;p&gt;You can also unbind custom events registered with bind.&lt;/p&gt;&lt;p&gt;If the type is provided, all bound events of that type are removed.&lt;/p&gt;&lt;p&gt;If the function that was passed to bind is provided as the second argument, only that specific event handler is removed.&lt;/p&gt;</longdesc><params name="type " optional="true" type="String"><desc>An event type to unbind.</desc></params><params name="data " optional="true" type="Function"><desc>A function to unbind from the event on each of the set of matched elements.</desc></params><example><desc>Can bind and unbind events to the colored button.</desc><code>

    function aClick() {
      $(&quot;div&quot;).show().fadeOut(&quot;slow&quot;);
    }
    $(&quot;#bind&quot;).click(function () {
      // could use .bind('click', aClick) instead but for variety...
      $(&quot;#theone&quot;).click(aClick)
                  .text(&quot;Can Click!&quot;);
    });
    $(&quot;#unbind&quot;).click(function () {
      $(&quot;#theone&quot;).unbind('click', aClick)
                  .text(&quot;Does nothing...&quot;);
    });

</code><css>
  button { margin:5px; }
  button#theone { color:red; background:yellow; }
  </css><html>&lt;button id=&quot;theone&quot;&gt;Does nothing...&lt;/button&gt;
  &lt;button id=&quot;bind&quot;&gt;Bind Click&lt;/button&gt;
  &lt;button id=&quot;unbind&quot;&gt;Unbind Click&lt;/button&gt;

  &lt;div style=&quot;display:none;&quot;&gt;Click!&lt;/div&gt;</html></example><example><desc>To unbind all events from all paragraphs, write:</desc><code>$(&quot;p&quot;).unbind()</code></example><example><desc>To unbind all click events from all paragraphs, write:</desc><code>$(&quot;p&quot;).unbind( &quot;click&quot; )</code></example><example><desc>To unbind just one previously bound handler, pass the function in as the second argument:</desc><code>var foo = function () {
  // code to handle some kind of event
};

$(&quot;p&quot;).bind(&quot;click&quot;, foo); // ... now foo will be called when paragraphs are clicked ...

$(&quot;p&quot;).unbind(&quot;click&quot;, foo); // ... foo will no longer be called.</code></example></method>
<method cat="Events" name="hover" return="jQuery" timestamp="2007-10-12T00:53:34Z"><desc>Simulates hovering (moving the mouse on, and off, an object). This is a custom method which provides an 'in' to a frequent task.</desc><longdesc>Whenever the mouse cursor is moved over a matched element, the first specified function is fired. Whenever the mouse moves off of the element, the second specified function fires. Additionally, checks are in place to see if the mouse is still within the specified element itself (for example, an image inside of a div), and if it is, it will continue to 'hover', and not move out (a common error in using a mouseout event handler).</longdesc><params name="over" type="Function"><desc>The function to fire when the mouse is moved over a matched element.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><params name="out" type="Function"><desc>The function to fire when the mouse is moved off of a matched element.
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>To add a special style to table cells that are being hovered over, try:</desc><code>
    $(&quot;li&quot;).hover(
      function () {
        $(this).append($(&quot;&lt;span&gt; ***&lt;/span&gt;&quot;));
      }, 
      function () {
        $(this).find(&quot;span:last&quot;).remove();
      }
    );

</code><css>
  ul { margin-left:20px; color:blue; }
  li { cursor:default; }
  span { color:red; }
  </css><html>&lt;ul&gt;
    &lt;li&gt;Milk&lt;/li&gt;
    &lt;li&gt;Bread&lt;/li&gt;
    &lt;li&gt;Chips&lt;/li&gt;

    &lt;li&gt;Socks&lt;/li&gt;
  &lt;/ul&gt;</html></example><example><desc>To add a special style to table cells that are being hovered over, try:</desc><code>$(&quot;td&quot;).hover(
  function () {
    $(this).addClass(&quot;hover&quot;);
  },
  function () {
    $(this).removeClass(&quot;hover&quot;);
  }
);</code></example></method>
<method cat="Events" name="toggle" return="jQuery" timestamp="2008-04-17T02:01:53Z"><desc>Toggle between two function calls every other click.</desc><longdesc>&lt;p&gt;Whenever a matched element is clicked, the first specified function is fired, when clicked again, the second is fired. All subsequent clicks continue to rotate through the two functions.&lt;/p&gt;&lt;p&gt;Use unbind(&quot;click&quot;) to remove.&lt;/p&gt;</longdesc><params name="fn" type="Function"><desc>The function to execute on every even click.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><params name="fn1" type="Function"><desc>The function to execute on every odd click.
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Click to toggle highlight on the list item.</desc><code>
    $(&quot;li&quot;).toggle(
      function () {
        $(this).css(&quot;list-style-type&quot;, &quot;disc&quot;)
               .css(&quot;color&quot;, &quot;blue&quot;);
      },
      function () {
        $(this).css({&quot;list-style-type&quot;:&quot;&quot;, &quot;color&quot;:&quot;&quot;});
      }
    );

</code><css>
  ul { margin:10px; list-style:inside circle; font-weight:bold; }
  li { cursor:pointer; }
  </css><html>&lt;ul&gt;
    &lt;li&gt;Go to the store&lt;/li&gt;
    &lt;li&gt;Pick up dinner&lt;/li&gt;
    &lt;li&gt;Debug crash&lt;/li&gt;

    &lt;li&gt;Take a jog&lt;/li&gt;
  &lt;/ul&gt;</html></example><example><desc>To toggle a style on table cells:</desc><code>$(&quot;td&quot;).toggle(
  function () {
    $(this).addClass(&quot;selected&quot;);
  },
  function () {
    $(this).removeClass(&quot;selected&quot;);
  }
);</code></example></method>
<method cat="Events" name="blur" return="jQuery" timestamp="2007-10-12T00:43:00Z"><added>1.0</added><desc>Triggers the blur event of each matched element.</desc><longdesc>This causes all of the functions that have been bound to that blur event to be executed, and calls the browser's default blur action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the blur event. The blur event usually fires when an element loses focus either via the pointing device or by tabbing navigation</longdesc><example><desc>To triggers the blur event on all paragraphs:</desc><code>$(&quot;p&quot;).blur();</code></example></method>
<method cat="Events" name="blur" return="jQuery" timestamp="2007-10-12T00:43:00Z"><added>1.0</added><desc>Bind a function to the blur event of each matched element.</desc><longdesc>The blur event fires when an element loses focus either via the pointing device or by tabbing navigation.</longdesc><params name="fn" type="Function"><desc>A function to bind to the blur event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>To pop up an alert saying &quot;Hello World!&quot; every time any paragraph's blur event triggers:</desc><code>$(&quot;p&quot;).blur( function () { alert(&quot;Hello World!&quot;); } );</code></example></method>
<method cat="Events" name="change" return="jQuery" timestamp="2008-03-17T01:32:27Z"><added>1.0</added><desc>Triggers the change event of each matched element.</desc><longdesc>This causes all of the functions that have been bound to that change event to be executed, and calls the browser's default change action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the change event. The change event usually fires when a control loses the input focus and its value has been modified since gaining focus.</longdesc></method>
<method cat="Events" name="change" return="jQuery" timestamp="2008-03-17T01:32:27Z"><added>1.0</added><desc>Binds a function to the change event of each matched element.</desc><longdesc>The change event fires when a control loses the input focus and its value has been modified since gaining focus.</longdesc><params name="fn" type="Function"><desc>A function to bind to the change event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><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);
        })
        .change();
</code><css>

  div { color:red; }
  </css><html>&lt;select name=&quot;sweets&quot; multiple=&quot;multiple&quot;&gt;
    &lt;option&gt;Chocolate&lt;/option&gt;
    &lt;option selected=&quot;selected&quot;&gt;Candy&lt;/option&gt;

    &lt;option&gt;Taffy&lt;/option&gt;
    &lt;option selected=&quot;selected&quot;&gt;Caramel&lt;/option&gt;
    &lt;option&gt;Fudge&lt;/option&gt;
    &lt;option&gt;Cookie&lt;/option&gt;

  &lt;/select&gt;
  &lt;div&gt;&lt;/div&gt;</html></example><example><desc>To add a validity test to all text input elements:</desc><code>$(&quot;input[@type='text']&quot;).change( function() {
  // check input for validity here
});</code></example></method>
<method cat="Events" name="click" return="jQuery" timestamp="2007-10-12T00:39:05Z"><added>1.0</added><desc>Triggers the click event of each matched element.</desc><longdesc>Causes all of the functions that have been bound to that click event to be executed.</longdesc><example><desc>To trigger the click event on all of the paragraphs on the page:</desc><code>$(&quot;p&quot;).click();</code></example></method>
<method cat="Events" name="click" return="jQuery" timestamp="2007-10-12T00:39:05Z"><added>1.0</added><desc>Binds a function to the click event of each matched element.</desc><longdesc>The click event fires when the pointing device button is clicked over an element. A click is defined as a mousedown and mouseup over the same screen location. The sequence of these events is:&lt;ul&gt;&lt;li&gt;mousedown&lt;/li&gt;&lt;li&gt;mouseup&lt;/li&gt;&lt;li&gt;click&lt;/li&gt;&lt;/ul&gt;</longdesc><params name="fn" type="Function"><desc>A function to bind to the click event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>To hide paragraphs on a page when they are clicked:</desc><code>
    $(&quot;p&quot;).click(function () { 
      $(this).slideUp(); 
    });
    $(&quot;p&quot;).hover(function () {
      $(this).addClass(&quot;hilite&quot;);
    }, function () {
      $(this).removeClass(&quot;hilite&quot;);
    });
</code><css>
  p { color:red; margin:5px; cursor:pointer; }
  p.hilite { background:yellow; }
  </css><html>&lt;p&gt;First Paragraph&lt;/p&gt;

  &lt;p&gt;Second Paragraph&lt;/p&gt;
  &lt;p&gt;Yet one more Paragraph&lt;/p&gt;</html></example></method>
<method cat="Events" name="dblclick" return="jQuery" timestamp="2008-01-24T17:10:37Z"><added>1.0</added><desc>Triggers the dblclick event of each matched element.</desc><longdesc>This causes all of the functions that have been bound to that dblclick event to be executed, and calls the browser's default dblclick action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the dblclick event. The dblclick event usually fires when the pointing device button is double clicked over an element.</longdesc></method>
<method cat="Events" name="dblclick" return="jQuery" timestamp="2008-01-24T17:10:37Z"><added>1.0</added><desc>Binds a function to the dblclick event of each matched element.</desc><longdesc>The dblclick event fires when the pointing device button is double clicked over an element</longdesc><params name="fn" type="Function"><desc>The function to bind to the dblclick event on each of the matched elements.
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}

&lt;/pre&gt;</desc></params><example><desc>To bind a &quot;Hello World!&quot; alert box the dblclick event on every paragraph on the page:</desc><code>$(&quot;p&quot;).dblclick( function () { alert(&quot;Hello World!&quot;); });</code></example><example><desc>Double click to toggle background color.</desc><code>
    var divdbl = $(&quot;div:first&quot;);
    divdbl.dblclick(function () { 
      divdbl.toggleClass('dbl'); 
    });

</code><css>

  div { background:blue;
        color:white;
        height:100px;
        width:150px;
 }
  div.dbl { background:yellow;color:black; }
  </css><html>&lt;div&gt;&lt;/div&gt;&lt;span&gt;Double click the block&lt;/span&gt;</html></example></method>
<method cat="Events" name="error" return="jQuery" timestamp="2007-10-12T00:36:14Z"><desc>Triggers the error event of each matched element.</desc><longdesc>This causes all of the functions that have been bound to that error event to be executed, and calls the browser's default error action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the error event. The error event usually fires when an element loses focus either via the pointing device or by tabbing navigation.</longdesc></method>
<method cat="Events" name="error" return="jQuery" timestamp="2007-10-12T00:36:14Z"><desc>Binds a function to the error event of each matched element.</desc><longdesc>&lt;p&gt;There is no public standard for the error event. In most browsers, the window object's error event is triggered when a JavaScript error occurs on the page. An image object's error event is triggered when it is set an invalid src attribute - either a non-existent file, or one with corrupt image data.&lt;/p&gt;&lt;p&gt;If the event is thrown by the window object, the event handler will be passed three parameters: &lt;ol&gt;&lt;li&gt;A message describing the event (&quot;varName is not defined&quot;, &quot;missing operator in expression&quot;, etc.),&lt;/li&gt;&lt;li&gt;the full URL of the document containing the error, and&lt;/li&gt;&lt;li&gt;the line number on which the error occured.&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;

&lt;p&gt;If the event handler returns true, it signifies that the event was handled, and the browser raises no errors.&lt;/p&gt;&lt;p&gt;For more information, see: &lt;ul&gt;&lt;li&gt;[http://msdn2.microsoft.com/en-us/library/ms536930.aspx msdn - onerror Event]&lt;/li&gt;&lt;li&gt;[http://developer.mozilla.org/en/docs/DOM:window.onerror Gecko DOM Reference - onerror Event]&lt;/li&gt;&lt;li&gt;[http://developer.mozilla.org/en/docs/DOM:event Gecko DOM Reference - Event object]&lt;/li&gt;&lt;li&gt;[http://en.wikipedia.org/wiki/DOM_Events Wikipedia: DOM Events]&lt;/ul&gt;&lt;/p&gt;</longdesc><params name="fn" type="Function"><desc>An event handler function to bind to the error event.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>To keep a server-side log of JavaScript errors, you might want to:</desc><code>$(window).error(function(msg, url, line){
  jQuery.post(&quot;js_error_log.php&quot;, { msg: msg, url: url, line: line });
});</code></example><example><desc>To hide JavaScript errors from the user, you can try:</desc><code>$(window).error(function(){
  return true;
});</code></example><example><desc>To hide the &quot;broken image&quot; icons for your IE users, you can try:</desc><code>$(&quot;img&quot;).error(function(){
  $(this).hide();
});</code></example></method>
<method cat="Events" name="focus" return="jQuery" timestamp="2008-01-24T17:38:17Z"><desc>Triggers the focus event of each matched element. </desc><longdesc>This causes all of the functions that have been bound to the focus event to be executed. Note that this does not execute the focus method of the underlying elements.</longdesc><example><desc>To focus on a login input box with id 'login' on page startup, try:</desc><code>$(document).ready(function(){
  $(&quot;#login&quot;).focus();
});</code></example></method>
<method cat="Events" name="focus" return="jQuery" timestamp="2008-01-24T17:38:17Z"><desc>Binds a function to the focus event of each matched element.</desc><longdesc>The focus event fires when an element receives focus either via the pointing device or by tab navigation.</longdesc><params name="fn" type="Function"><desc>A function to bind to the focus event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Fire focus.</desc><css>span {display:none;}</css><code>
    $(&quot;input&quot;).focus(function () {
         $(this).next(&quot;span&quot;).css('display','inline').fadeOut(1000);
    });
</code><html>&lt;p&gt;&lt;input type=&quot;text&quot; /&gt; &lt;span&gt;focus fire&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;input type=&quot;password&quot; /&gt; &lt;span&gt;focus fire&lt;/span&gt;&lt;/p&gt;</html></example><example><desc>To stop people from writing in text input boxes, try:</desc><code>$(&quot;input[@type=text]&quot;).focus(function(){
  $(this).blur();
});</code></example></method>
<method cat="Events" name="keydown" return="jQuery" timestamp="2007-10-12T00:29:39Z"><desc>Triggers the keydown event of each matched element.</desc><longdesc>This causes all of the functions that have been bound to the keydown event to be executed, and calls the browser's default keydown action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the keydown event. The keydown event usually fires when a key on the keyboard is pressed.</longdesc></method>
<method cat="Events" name="keydown" return="jQuery" timestamp="2007-10-12T00:29:39Z"><desc>Bind a function to the keydown event of each matched element.</desc><longdesc>The keydown event fires when a key on the keyboard is pressed.</longdesc><params name="fn" type="Function"><desc>A function to bind to the keydown event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>To perform actions in response to keyboard presses on a page, try:</desc><code>$(window).keydown(function(event){
  switch (event.keyCode) {
    // ...
    // different keys do different things
    // Different browsers provide different codes
    // see here for details: http://unixpapa.com/js/key.html    
    // ...
  }
});</code></example></method>
<method cat="Events" name="keypress" return="jQuery" timestamp="2007-10-12T00:23:40Z"><desc>Triggers the keypress event of each matched element.</desc><longdesc>This causes all of the functions that have been bound to the keypress event to be executed, and calls the browser's default keypress action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the keypress event. The keypress event usually fires when a key on the keyboard is pressed.
</longdesc></method>
<method cat="Events" name="keypress" return="jQuery" timestamp="2007-10-12T00:23:40Z"><desc>Binds a function to the keypress event of each matched element.</desc><longdesc>The keypress event fires when a key on the keyboard is &quot;clicked&quot;. A keypress is defined as a keydown and keyup on the same key. The sequence of these events is: &lt;ul&gt;&lt;li&gt;keydown&lt;/li&gt;&lt;li&gt;keyup&lt;/li&gt;&lt;li&gt;keypress&lt;/li&gt;&lt;/ul&gt;</longdesc><params name="fn" type="Function"><desc>A function to bind to the keypress event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Show spaces and letters when typed.</desc><code>
    $(&quot;input&quot;).keypress(function (e) {
      if (e.which == 32 || (65 &lt;= e.which &amp;&amp; e.which &lt;= 65 + 25)
                        || (97 &lt;= e.which &amp;&amp; e.which &lt;= 97 + 25)) {
        var c = String.fromCharCode(e.which);
        $(&quot;p&quot;).append($(&quot;&lt;span/&gt;&quot;))
              .children(&quot;:last&quot;)
              .append(document.createTextNode(c));
      } else if (e.which == 8) {
        // backspace in IE only be on keydown
        $(&quot;p&quot;).children(&quot;:last&quot;).remove();
      }
      $(&quot;div&quot;).text(e.which);
    });

</code><css>
  input { margin:10px; }
  p { color:blue; margin:10px; font-size:18px; }
  p.hilite { background:yellow; }
  div { color:red; }
  </css><html>&lt;input type=&quot;text&quot; /&gt;
  &lt;p&gt;Add text - &lt;/p&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></method>
<method cat="Events" name="keyup" return="jQuery" timestamp="2007-11-19T18:18:30Z"><desc>Triggers the keyup event of each matched element.</desc><longdesc>This causes all of the functions that have been bound to the keyup event to be executed, and calls the browser's default keyup action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the keyup event. The keyup event usually fires when a key on the keyboard is released.</longdesc></method>
<method cat="Events" name="keyup" return="jQuery" timestamp="2007-11-19T18:18:30Z"><desc>Bind a function to the keyup event of each matched element.</desc><longdesc>The keyup event fires when a key on the keyboard is released.</longdesc><params name="fn" type="Function"><desc>A function to bind to the keyup event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>To perform an action when the escape key has been released:</desc><code>$(document).keyup(function(event){
    if (event.keyCode == 27) {
        alert('escaped!');
    }
});</code></example></method>
<method cat="Events" name="load " return="jQuery" timestamp="2008-03-07T21:30:45Z"><desc>Binds a function to the load event of each matched element.</desc><longdesc>When bound to the window element, the event fires when the user agent finishes loading all content within a document, including window, frames, objects and images. For elements, it fires when the target element and all of its content has finished loading. Note: load will work only if you set it before the element has completely loaded, if you set it after that nothing will happen. This doesn't happen in $(document).ready(), which jQuery handles it to work as expected, also when setting it after the DOM has loaded.
 </longdesc><params name="fn" type="Function"><desc>A function to bind to the load event on each of the matched elements.
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Run a function when the page is fully loaded including graphics.</desc><code>
    $(window).load(function () {
      // run code
    });
</code></example></method>
<method cat="Events" name="mousedown " return="jQuery" timestamp="2008-01-23T02:27:21Z"><desc>Binds a function to the mousedown event of each matched element.</desc><longdesc>The mousedown event fires when the pointing device button is pressed over an element.</longdesc><params name="fn" type="Function"><desc>A function to bind to the mousedown event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Show texts when mouseup and mousedown event triggering.</desc><code>
    $(&quot;p&quot;).mouseup(function(){
      $(this).append('&lt;span style=&quot;color:#F00;&quot;&gt;Mouse up.&lt;/span&gt;');
    }).mousedown(function(){
      $(this).append('&lt;span style=&quot;color:#00F;&quot;&gt;Mouse down.&lt;/span&gt;');
    });

</code><html>&lt;p&gt;Press mouse and release here.&lt;/p&gt;
</html></example></method>
<method cat="Events" name="mousemove" return="jQuery" timestamp="2007-10-11T23:54:48Z"><desc>Bind a function to the mousemove event of each matched element.</desc><longdesc>The mousemove event fires when the pointing device is moved while it is over an element. The event handler is passed one variable - the event object. Its .clientX and .clientY properties represent the coordinates of the mouse.</longdesc><params name="fn" type="Function"><desc>A function to bind to the mousmove event on each of the matched elements.
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Show the mouse coordinates when the mouse is moved over the yellow div.  Coordinates are relative to the window which in this case is the iframe.</desc><code>
    $(&quot;div&quot;).mousemove(function(e){
      var pageCoords = &quot;( &quot; + e.pageX + &quot;, &quot; + e.pageY + &quot; )&quot;;
      var clientCoords = &quot;( &quot; + e.clientX + &quot;, &quot; + e.clientY + &quot; )&quot;;
      $(&quot;span:first&quot;).text(&quot;( e.pageX, e.pageY ) - &quot; + pageCoords);
      $(&quot;span:last&quot;).text(&quot;( e.clientX, e.clientY ) - &quot; + clientCoords);
    });

</code><css>
  div { width:250px; height:170px; margin;10px; margin-right:50px;
        background:yellow; border:2px groove; float:right; }
  p { margin:0; margin-left:10px; color:red; width:250px;
      height:120px; padding-top:70px;
      float:left; font-size:14px; }
  span { display:block; }
  </css><html>&lt;p&gt;   
    Try scrolling too.
    &lt;span&gt;Move the mouse over the div.&lt;/span&gt;
    &lt;span&gt;&amp;nbsp;&lt;/span&gt;
  &lt;/p&gt;

  &lt;div&gt;&lt;/div&gt;</html></example></method>
<method cat="Events" name="mouseout" return="jQuery" timestamp="2008-02-21T09:07:21Z"><desc>Bind a function to the mouseout event of each matched element.</desc><longdesc>The mouseout event fires when the pointing device is moved away from an element.</longdesc><params name="fn" type="Function"><desc>A function to bind to the mouseout event on each of the matched elements.
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Show texts when mouseover and mouseout event triggering.
'''Mouseout''' fires when pointer move into or out from child element, while '''mouseleave''' doesn't.</desc><css>
div.out {
width:40%;
height:120px;
margin:0 15px;
background-color:#D6EDFC;
float:left;
}
div.in {
width:60%;
height:60%;
background-color:#FFCC00;
margin:10px auto;
}
p {
line-height:1em;
margin:0;
padding:0;
}
</css><code>
    var i = 0;
    $(&quot;div.overout&quot;).mouseout(function(){
      $(&quot;p:first&quot;,this).text(&quot;mouse out&quot;);
      $(&quot;p:last&quot;,this).text(++i);
    }).mouseover(function(){
      $(&quot;p:first&quot;,this).text(&quot;mouse over&quot;);
    });

    var n = 0;
    $(&quot;div.enterleave&quot;).bind(&quot;mouseenter&quot;,function(){
      $(&quot;p:first&quot;,this).text(&quot;mouse enter&quot;);
    }).bind(&quot;mouseleave&quot;,function(){
      $(&quot;p:first&quot;,this).text(&quot;mouse leave&quot;);
      $(&quot;p:last&quot;,this).text(++n);
    });

</code><html>
&lt;div class=&quot;out overout&quot;&gt;&lt;p&gt;move your mouse&lt;/p&gt;&lt;div class=&quot;in overout&quot;&gt;&lt;p&gt;move your mouse&lt;/p&gt;&lt;p&gt;0&lt;/p&gt;&lt;/div&gt;&lt;p&gt;0&lt;/p&gt;&lt;/div&gt;

&lt;div class=&quot;out enterleave&quot;&gt;&lt;p&gt;move your mouse&lt;/p&gt;&lt;div class=&quot;in enterleave&quot;&gt;&lt;p&gt;move your mouse&lt;/p&gt;&lt;p&gt;0&lt;/p&gt;&lt;/div&gt;&lt;p&gt;0&lt;/p&gt;&lt;/div&gt;

</html></example></method>
<method cat="Events" name="mouseover" return="jQuery" timestamp="2008-04-25T03:33:17Z"><desc>Bind a function to the mouseover event of each matched element.</desc><longdesc>The mouseover event fires when the pointing device is moved onto an element.</longdesc><params name="fn" type="Function"><desc>A function to bind to the mouseover event on each of the matched elements.
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Show texts when mouseover and mouseout event triggering.
'''Mouseover''' fires when the pointer moves into or out from child element, while '''mouseenter''' does't.</desc><css>
div.out {
width:40%;
height:120px;
margin:0 15px;
background-color:#D6EDFC;
float:left;
}
div.in {
width:60%;
height:60%;
background-color:#FFCC00;
margin:10px auto;
}
p {
line-height:1em;
margin:0;
padding:0;
}
</css><code>
    var i = 0;
    $(&quot;div.overout&quot;).mouseover(function(){
      $(&quot;p:first&quot;,this).text(&quot;mouse over&quot;);
      $(&quot;p:last&quot;,this).text(++i);
    }).mouseout(function(){
      $(&quot;p:first&quot;,this).text(&quot;mouse out&quot;);
    });

    var n = 0;
    $(&quot;div.enterleave&quot;).bind(&quot;mouseenter&quot;,function(){
      $(&quot;p:first&quot;,this).text(&quot;mouse enter&quot;);
      $(&quot;p:last&quot;,this).text(++n);
    }).bind(&quot;mouseleave&quot;,function(){
      $(&quot;p:first&quot;,this).text(&quot;mouse leave&quot;);
    });

</code><html>
&lt;div class=&quot;out overout&quot;&gt;&lt;p&gt;move your mouse&lt;/p&gt;&lt;div class=&quot;in overout&quot;&gt;&lt;p&gt;move your mouse&lt;/p&gt;&lt;p&gt;0&lt;/p&gt;&lt;/div&gt;&lt;p&gt;0&lt;/p&gt;&lt;/div&gt;

&lt;div class=&quot;out enterleave&quot;&gt;&lt;p&gt;move your mouse&lt;/p&gt;&lt;div class=&quot;in enterleave&quot;&gt;&lt;p&gt;move your mouse&lt;/p&gt;&lt;p&gt;0&lt;/p&gt;&lt;/div&gt;&lt;p&gt;0&lt;/p&gt;&lt;/div&gt;

</html></example></method>
<method cat="Events" name="mouseup" return="jQuery" timestamp="2008-01-23T02:28:30Z"><desc>Bind a function to the mouseup event of each matched element.</desc><longdesc>The mouseup event fires when the pointing device button is released over an element.</longdesc><params name="fn" type="Function"><desc>A function to bind to the mouseup event on each of the matched elements.
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Show texts when mouseup and mousedown event triggering.</desc><code>
    $(&quot;p&quot;).mouseup(function(){
      $(this).append('&lt;span style=&quot;color:#F00;&quot;&gt;Mouse up.&lt;/span&gt;');
    }).mousedown(function(){
      $(this).append('&lt;span style=&quot;color:#00F;&quot;&gt;Mouse down.&lt;/span&gt;');
    });

</code><html>&lt;p&gt;Press mouse and release here.&lt;/p&gt;
</html></example></method>
<method cat="Events" name="resize" return="jQuery" timestamp="2007-10-11T23:50:57Z"><desc>Bind a function to the resize event of each matched element.</desc><longdesc>The resize event fires when a document view is resized</longdesc><params name="fn" type="Function"><desc>A function to bind to the resize event on each of the matched elements.
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>To make resizing the web page window a pain in the neck, try:</desc><code>$(window).resize(function(){
  alert(&quot;Stop it!&quot;);
});</code></example></method>
<method cat="Events" name="scroll" return="jQuery" timestamp="2007-10-11T23:48:18Z"><desc>Bind a function to the scroll event of each matched element.</desc><longdesc>The scroll event fires when a document view is scrolled.</longdesc><params name="fn" type="Function"><desc>A function to bind to the scroll event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>To do something when your page is scrolled:</desc><code>
    $(&quot;p&quot;).clone().appendTo(document.body);
    $(&quot;p&quot;).clone().appendTo(document.body);
    $(&quot;p&quot;).clone().appendTo(document.body);
    $(window).scroll(function () { 
      $(&quot;span&quot;).css(&quot;display&quot;, &quot;inline&quot;).fadeOut(&quot;slow&quot;); 
    });

</code><css>
  div { color:blue; }
  p { color:green; }
  span { color:red; display:none; }
  </css><html>&lt;div&gt;Try scrolling the iframe.&lt;/div&gt;
  &lt;p&gt;Paragraph - &lt;span&gt;Scroll happened!&lt;/span&gt;&lt;/p&gt;</html></example></method>
<method cat="Events" name="select" return="jQuery" timestamp="2008-02-28T17:54:02Z"><desc>Trigger the select event of each matched element.</desc><longdesc>This causes all of the functions that have been bound to that select event to be executed, and calls the browser's default select action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the select event.


Note: Do not confuse the &quot;select&quot; event with the &quot;change&quot; event, which is the one triggered when an html &quot;select&quot; element is having its selected option modified by the user.</longdesc><example><desc>To trigger the select event on all input elements, try:</desc><code>$(&quot;input&quot;).select();</code></example></method>
<method cat="Events" name="select" return="jQuery" timestamp="2008-02-28T17:54:02Z"><desc>Bind a function to the select event of each matched element.</desc><longdesc>The select event fires when a user selects some text in a text field, including input and textarea.</longdesc><params name="fn" type="Function"><desc>A function to bind to the select event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>To do something when text in input boxes is selected:</desc><code>
    $(document).select( function () { 
      $(&quot;div&quot;).text(&quot;Something was selected&quot;).show().fadeOut(1000); 
    });
</code><css>
  p { color:blue; }
  div { color:red; }
  </css><html>&lt;p&gt;
    Click and drag the mouse to select text in the inputs.
  &lt;/p&gt;

  &lt;input type=&quot;text&quot; value=&quot;Some text&quot; /&gt;
  &lt;input type=&quot;text&quot; value=&quot;to test on&quot; /&gt;

  &lt;div&gt;&lt;/div&gt;</html></example></method>
<method cat="Events" name="submit" return="jQuery" timestamp="2007-10-11T23:26:31Z"><desc>Trigger the submit event of each matched element.</desc><longdesc>This causes all of the functions that have been bound to that submit event to be executed, and calls the browser's default submit action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the submit event.</longdesc><example><desc>To trigger the submit event on the first form on the page, try:</desc><code>$(&quot;form:first&quot;).submit();</code></example></method>
<method cat="Events" name="submit" return="jQuery" timestamp="2007-10-11T23:26:31Z"><desc>Bind a function to the submit event of each matched element.</desc><longdesc>The select event fires when a form is submitted</longdesc><params name="fn" type="Function"><desc>A function to bind to the submit event on each of the matched elements.
&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>If you'd like to prevent forms from being submitted unless a flag variable is set, try:</desc><code>

    $(&quot;form&quot;).submit(function() {
      if ($(&quot;input:first&quot;).val() == &quot;correct&quot;) {
        $(&quot;span&quot;).text(&quot;Validated...&quot;).show();
        return true;
      }
      $(&quot;span&quot;).text(&quot;Not valid!&quot;).show().fadeOut(1000);
      return false;
    });
</code><css>

  p { margin:0; color:blue; }
  div,p { margin-left:10px; }
  span { color:red; }
  </css><html>&lt;p&gt;Type 'correct' to validate.&lt;/p&gt;
  &lt;form action=&quot;javascript:alert('success!');&quot;&gt;
    &lt;div&gt;
      &lt;input type=&quot;text&quot; /&gt;

      &lt;input type=&quot;submit&quot; /&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  &lt;span&gt;&lt;/span&gt;</html></example><example><desc>If you'd like to prevent forms from being submitted unless a flag variable is set, try:</desc><code>$(&quot;form&quot;).submit( function () {
  return this.some_flag_variable;
} );</code></example></method>
<method cat="Events" name="unload" return="jQuery" timestamp="2007-11-03T04:26:04Z"><desc>Binds a function to the unload event of each matched element.</desc><longdesc></longdesc><params name="fn" type="Function"><desc>function to bind to the unload event on each of the matched elements.

&lt;pre&gt;function callback(eventObject) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>To display an alert when a page is unloaded:</desc><code>$(window).unload( function () { alert(&quot;Bye now!&quot;); } );</code></example></method>

<method cat="Effects" name="show" return="jQuery" timestamp="2007-10-11T23:03:37Z"><added>1.0</added><desc>Displays each of the set of matched elements if they are hidden.</desc><longdesc>Same as <![CDATA[<a href='Effects/show#speedcallback'>show( speed, [callback] )</a>]]> without animations. Doesn't change anything if the selected elements are all visible. It doesn't matter if the element is hidden via a hide() call, or via a display:none in a stylesheet.</longdesc><example><desc>Shows all paragraphs.</desc><code>$(&quot;p&quot;).show()</code><html>&lt;p style=&quot;display:none&quot;&gt;Hello&lt;/p&gt;</html></example></method>
<method cat="Effects" name="show" return="jQuery" timestamp="2007-10-11T23:03:37Z"><added>1.0</added><desc>Show all matched elements using a graceful animation and firing an optional callback after completion.</desc><longdesc>The height, width, and opacity of each of the matched elements are changed dynamically according to the specified speed.</longdesc><params name="speed" type="String, Number "><desc>A string representing one of the three predefined speeds (&quot;slow&quot;, &quot;normal&quot;, or &quot;fast&quot;) or the number of milliseconds to run the animation (e.g. 1000).</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the animation completes, executes once for each element animated against.

&lt;pre&gt;function callback() {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Animates all hidden paragraphs to show slowly, completing the animation within 600 milliseconds.</desc><code>
    $(&quot;button&quot;).click(function () {
      $(&quot;p&quot;).show(&quot;slow&quot;);
    });
</code><css>
  p { background:yellow; }
  </css><html>&lt;button&gt;Show it&lt;/button&gt;

  &lt;p style=&quot;display: none&quot;&gt;Hello&lt;/p&gt;</html></example><example><desc>Animates all hidden divs to show fastly in order, completing each animation within 200 milliseconds. Once each animation is done, it starts the next one.</desc><code>
    $(&quot;#showr&quot;).click(function () {
      $(&quot;div:eq(0)&quot;).show(&quot;fast&quot;, function () {
        // use callee so don't have to name the function
        $(this).next().show(&quot;fast&quot;, arguments.callee); 
      });
    });
    $(&quot;#hidr&quot;).click(function () {
      $(&quot;div&quot;).hide(2000);
    });

</code><css>
  div { background:#def3ca; margin:3px; width:80px; 
        display:none; float:left; text-align:center; }
  </css><html>&lt;button id=&quot;showr&quot;&gt;Show&lt;/button&gt;
  &lt;button id=&quot;hidr&quot;&gt;Hide&lt;/button&gt;
  &lt;div&gt;Hello,&lt;/div&gt;

  &lt;div&gt;how&lt;/div&gt;
  &lt;div&gt;are&lt;/div&gt;
  &lt;div&gt;you?&lt;/div&gt;</html></example><example><desc>Animates all span and input elements to show normally. Once the animation is done, it changes the text.</desc><code>
    function doIt() {
      $(&quot;span,div&quot;).show(&quot;normal&quot;);
    }
    $(&quot;button&quot;).click(doIt); // can pass in function name
    $(&quot;form&quot;).submit(function () {
      if ($(&quot;input&quot;).val() == &quot;yes&quot;) {
        $(&quot;p&quot;).show(4000, function () {
          $(this).text(&quot;Ok, DONE! (now showing)&quot;);
        });
      }
      $(&quot;span,div&quot;).hide(&quot;normal&quot;);
      return false; // to stop the submit
    });

</code><css>
  span { display:none; }
  div { display:none; }
  p { font-weight:bold; background-color:#fcd; }
  </css><html>&lt;button&gt;Do it!&lt;/button&gt;
  &lt;span&gt;Are you sure? (type 'yes' if you are) &lt;/span&gt;
  &lt;div&gt;
    &lt;form&gt;

      &lt;input type=&quot;text&quot; /&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  &lt;p style=&quot;display:none;&quot;&gt;I'm hidden...&lt;/p&gt;</html></example></method>
<method cat="Effects" name="hide" return="jQuery" timestamp="2007-10-11T22:59:22Z"><added>1.0</added><desc>Hides each of the set of matched elements if they are shown.</desc><longdesc>Same as <![CDATA[<a href='Effects/hide#speedcallback'>hide( speed, [callback] )</a>]]> without animations. Doesn't change anything if the selected elements are all hidden.</longdesc><example><desc>Hides all paragraphs then the link on click.</desc><code>

    $(&quot;p&quot;).hide();
    $(&quot;a&quot;).click(function () {
      $(this).hide();
      return false;
    });
</code><html>&lt;p&gt;Hello&lt;/p&gt;
  &lt;a href=&quot;#&quot;&gt;Click to hide me too&lt;/a&gt;
  &lt;p&gt;Here is another paragraph&lt;/p&gt;</html></example></method>
<method cat="Effects" name="hide" return="jQuery" timestamp="2007-10-11T22:59:22Z"><added>1.0</added><desc>Hide all matched elements using a graceful animation and firing an optional callback after completion.</desc><longdesc>The height, width, and opacity of each of the matched elements are changed dynamically according to the specified speed.</longdesc><params name="speed" type="String, Number "><desc>A string representing one of the three predefined speeds (&quot;slow&quot;, &quot;normal&quot;, or &quot;fast&quot;) or the number of milliseconds to run the animation (e.g. 1000).</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the animation completes, executes once for each element animated against.

&lt;pre&gt;function callback() {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Animates all shown paragraphs to hide slowly, completing the animation within 600 milliseconds.</desc><code>
    $(&quot;button&quot;).click(function () {
      $(&quot;p&quot;).hide(&quot;slow&quot;);
    });    
</code><css>
  p { background:#dad; font-weight:bold; }
  </css><html>&lt;button&gt;Hide 'em&lt;/button&gt;

  &lt;p&gt;Hiya&lt;/p&gt;
  &lt;p&gt;Such interesting text, eh?&lt;/p&gt;</html></example><example><desc>Animates all spans (words in this case) to hide fastly, completing each animation within 200 milliseconds. Once each animation is done, it starts the next one.</desc><code>
    $(&quot;#hidr&quot;).click(function () {
      $(&quot;span:last-child&quot;).hide(&quot;fast&quot;, function () {
        // use callee so don't have to name the function
        $(this).prev().hide(&quot;fast&quot;, arguments.callee); 
      });
    });
    $(&quot;#showr&quot;).click(function () {
      $(&quot;span&quot;).show(2000);
    });

</code><css>
  span { background:#def3ca; padding:3px; float:left; }
  </css><html>&lt;button id=&quot;hidr&quot;&gt;Hide&lt;/button&gt;
  &lt;button id=&quot;showr&quot;&gt;Show&lt;/button&gt;
  &lt;div&gt;

    &lt;span&gt;Once&lt;/span&gt; &lt;span&gt;upon&lt;/span&gt; &lt;span&gt;a&lt;/span&gt; 
    &lt;span&gt;time&lt;/span&gt; &lt;span&gt;there&lt;/span&gt; &lt;span&gt;were&lt;/span&gt; 
    &lt;span&gt;three&lt;/span&gt; &lt;span&gt;programmers...&lt;/span&gt;

  &lt;/div&gt;</html></example><example><desc>Hides the divs when clicked over 2 seconds, then removes the div element when its hidden.  Try clicking on more than one box at a time.</desc><code>
    for (var i = 0; i &lt; 5; i++) {
      $(&quot;&lt;div&gt;&quot;).appendTo(document.body);
    }
    $(&quot;div&quot;).click(function () {
      $(this).hide(2000, function () {
        $(this).remove();
      });
    });
</code><css>
  div { background:#ece0fb; width:30px; 
        height:40px; margin:2px; float:left; }
  </css><html>&lt;div&gt;&lt;/div&gt;</html></example></method>
<method cat="Effects" name="toggle" return="jQuery" timestamp="2008-05-13T11:29:29Z"><added>1.0</added><desc>Toggles displaying each of the set of matched elements.</desc><longdesc>If they are shown, toggle makes them hidden. If they are hidden, toggle makes them shown.</longdesc><example><desc>Toggles all paragraphs.</desc><code>

    $(&quot;button&quot;).click(function () {
      $(&quot;p&quot;).toggle();
    });
</code><html>&lt;button&gt;Toggle&lt;/button&gt;
  &lt;p&gt;Hello&lt;/p&gt;
  &lt;p style=&quot;display: none&quot;&gt;Good Bye&lt;/p&gt;</html></example></method>
<method cat="Effects" name="slideDown" return="jQuery" timestamp="2007-10-11T22:53:58Z"><added>1.0</added><desc>Reveal all matched elements by adjusting their height and firing an optional callback after completion.</desc><longdesc>Only the height is adjusted for this animation, causing all matched elements to be revealed in a &quot;sliding&quot; manner.</longdesc><params name="speed" type="String, Number "><desc>A string representing one of the three predefined speeds (&quot;slow&quot;, &quot;normal&quot;, or &quot;fast&quot;) or the number of milliseconds to run the animation (e.g. 1000).</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the animation completes, executes once for each element animated against.

&lt;pre&gt;function callback() {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Animates all divs to slide down and show themselves over 600 milliseconds.</desc><code>
    $(document.body).click(function () {
      if ($(&quot;div:first&quot;).is(&quot;:hidden&quot;)) {
        $(&quot;div&quot;).slideDown(&quot;slow&quot;);
      } else {
        $(&quot;div&quot;).hide();
      }
    });

</code><css>
  div { background:#de9a44; margin:3px; width:80px; 
        height:40px; display:none; float:left; }
  </css><html>Click me!
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example><example><desc>Animates all inputs to slide down, completing the animation within 1000 milliseconds. Once the animation is done, the input look is changed especially if it is the middle input which gets the focus.</desc><code>
    $(&quot;div&quot;).click(function () {
      $(this).css({ borderStyle:&quot;inset&quot;, cursor:&quot;wait&quot; });
      $(&quot;input&quot;).slideDown(1000,function(){
        $(this).css(&quot;border&quot;, &quot;2px red inset&quot;)
               .filter(&quot;.middle&quot;)
                 .css(&quot;background&quot;, &quot;yellow&quot;)
                 .focus();
        $(&quot;div&quot;).css(&quot;visibility&quot;, &quot;hidden&quot;);
      });
    });

</code><css>
  div { background:#cfd; margin:3px; width:50px; 
        text-align:center; float:left; cursor:pointer;
        border:2px outset black; font-weight:bolder; }
  input { display:none; width:120px; float:left; 
          margin:10px; }
  </css><html>&lt;div&gt;Push!&lt;/div&gt;
  &lt;input type=&quot;text&quot; /&gt;
  &lt;input type=&quot;text&quot; class=&quot;middle&quot; /&gt;

  &lt;input type=&quot;text&quot; /&gt;</html></example></method>
<method cat="Effects" name="slideUp" return="jQuery" timestamp="2008-01-31T12:19:57Z"><added>1.0</added><desc>Hide all matched elements by adjusting their height and firing an optional callback after completion.</desc><longdesc>Only the height is adjusted for this animation, causing all matched elements to be hidden in a &quot;sliding&quot; manner.</longdesc><params name="speed" type="String, Number "><desc>A string representing one of the three predefined speeds (&quot;slow&quot;, &quot;normal&quot;, or &quot;fast&quot;) or the number of milliseconds to run the animation (e.g. 1000).</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the animation completes, executes once for each element animated against.

&lt;pre&gt;function callback() {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Animates all divs to slide up, completing the animation within 400 milliseconds.</desc><code>
    $(document.body).click(function () {
      if ($(&quot;div:first&quot;).is(&quot;:hidden&quot;)) {
        $(&quot;div&quot;).show(&quot;slow&quot;);
      } else {
        $(&quot;div&quot;).slideUp();
      }
    });

</code><css>
  div { background:#3d9a44; margin:3px; width:80px; 
        height:40px; float:left; }
  </css><html>Click me!
  &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>Animates all paragraph to slide up, completing the animation within 200 milliseconds. Once the animation is done, it displays an alert.</desc><code>
    $(&quot;button&quot;).click(function () {
      $(this).parent().slideUp(&quot;slow&quot;, function () {
        $(&quot;#msg&quot;).text($(&quot;button&quot;, this).text() + &quot; has completed.&quot;);
      });
    });

</code><css>
  div { margin:2px; }
  </css><html>&lt;div&gt;
    &lt;button&gt;Hide One&lt;/button&gt;
    &lt;input type=&quot;text&quot; value=&quot;One&quot; /&gt;

  &lt;/div&gt;
  &lt;div&gt;
    &lt;button&gt;Hide Two&lt;/button&gt;
    &lt;input type=&quot;text&quot; value=&quot;Two&quot; /&gt;

  &lt;/div&gt;
  &lt;div&gt;
    &lt;button&gt;Hide Three&lt;/button&gt;
    &lt;input type=&quot;text&quot; value=&quot;Three&quot; /&gt;

  &lt;/div&gt;
  &lt;div id=&quot;msg&quot;&gt;&lt;/div&gt;</html></example></method>
<method cat="Effects" name="slideToggle" return="jQuery" timestamp="2007-10-11T22:48:47Z"><added>1.0</added><desc>Toggle the visibility of all matched elements by adjusting their height and firing an optional callback after completion.</desc><longdesc>Only the height is adjusted for this animation, causing all matched elements to be hidden or shown in a &quot;sliding&quot; manner.</longdesc><params name="speed" type="String, Number "><desc>A string representing one of the three predefined speeds (&quot;slow&quot;, &quot;normal&quot;, or &quot;fast&quot;) or the number of milliseconds to run the animation (e.g. 1000).</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the animation completes, executes once for each element animated against.

&lt;pre&gt;function callback() {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Animates all paragraphs to slide up or down, completing the animation within 600 milliseconds.</desc><code>
    $(&quot;button&quot;).click(function () {
      $(&quot;p&quot;).slideToggle(&quot;slow&quot;);
    });
</code><css>
  p { width:400px; }
  </css><html>&lt;button&gt;Toggle&lt;/button&gt;

  &lt;p&gt;
    This is the paragraph to end all paragraphs.  You
    should feel &lt;em&gt;lucky&lt;/em&gt; to have seen such a paragraph in
    your life.  Congratulations!
  &lt;/p&gt;</html></example><example><desc>Animates divs between dividers with a toggle that makes some appear and some disappear.</desc><code>
    $(&quot;button&quot;).click(function () {
      $(&quot;div:not(.still)&quot;).slideToggle(&quot;slow&quot;, function () {
        var n = parseInt($(&quot;span&quot;).text(), 10);
        $(&quot;span&quot;).text(n + 1);
      });
    });

</code><css>
  div { background:#b977d1; margin:3px; width:60px; 
        height:60px; float:left; }
  div.still { background:#345; width:5px; }
  div.hider { display:none; }
  span { color:red; }
  </css><html>&lt;button&gt;Toggle&lt;/button&gt; There have been &lt;span&gt;0&lt;/span&gt; toggled divs.
  &lt;div&gt;&lt;/div&gt;&lt;div class=&quot;still&quot;&gt;&lt;/div&gt;

  &lt;div style=&quot;display:none;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;still&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;&lt;div class=&quot;still&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;hider&quot;&gt;&lt;/div&gt;&lt;div class=&quot;still&quot;&gt;&lt;/div&gt;

  &lt;div class=&quot;hider&quot;&gt;&lt;/div&gt;&lt;div class=&quot;still&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></method>
<method cat="Effects" name="fadeIn" return="jQuery" timestamp="2007-10-11T22:46:39Z"><added>1.0</added><desc>Fade in all matched elements by adjusting their opacity and firing an optional callback after completion.</desc><longdesc>Only the opacity is adjusted for this animation, meaning that all of the matched elements should already have some form of height and width associated with them.</longdesc><params name="speed" type="String, Number "><desc>A string representing one of the three predefined speeds (&quot;slow&quot;, &quot;normal&quot;, or &quot;fast&quot;) or the number of milliseconds to run the animation (e.g. 1000).</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the animation completes, executes once for each element animated against.

&lt;pre&gt;function callback() {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Animates hidden divs to fade in one by one, completing each animation within 600 milliseconds.</desc><code>
    $(document.body).click(function () {
      $(&quot;div:hidden:first&quot;).fadeIn(&quot;slow&quot;);
    });
</code><css>
  span { color:red; cursor:pointer; }
  div { margin:3px; width:80px; display:none;
        height:80px; float:left; }
  div#one { background:#f00; }
  div#two { background:#0f0; }
  div#three { background:#00f; }
  </css><html>&lt;span&gt;Click here...&lt;/span&gt;

  &lt;div id=&quot;one&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;two&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;three&quot;&gt;&lt;/div&gt;</html></example><example><desc>Fades a red block in over the text. Once the animation is done, it quickly fades in more text on top.</desc><code>
    $(&quot;a&quot;).click(function () {
      $(&quot;div&quot;).fadeIn(3000, function () {
        $(&quot;span&quot;).fadeIn(100);
      });
      return false;
    }); 

</code><css>
  p { position:relative; width:400px; height:90px; }
  div { position:absolute; width:400px; height:65px; 
        font-size:36px; text-align:center; 
        color:yellow; background:red;
        padding-top:25px; 
        top:0; left:0; display:none; }
  span { display:none; }
  </css><html>&lt;p&gt;
    Let it be known that the party of the first part
    and the party of the second part are henceforth
    and hereto directed to assess the allegations
    for factual correctness... (&lt;a href=&quot;#&quot;&gt;click!&lt;/a&gt;)
    &lt;div&gt;&lt;span&gt;CENSORED!&lt;/span&gt;&lt;/div&gt;

  &lt;/p&gt;</html></example></method>
<method cat="Effects" name="fadeOut" return="jQuery" timestamp="2007-10-11T22:37:54Z"><added>1.0</added><desc>Fade out all matched elements by adjusting their opacity and firing an optional callback after completion.</desc><longdesc>Only the opacity is adjusted for this animation, meaning that all of the matched elements should already have some form of height and width associated with them.</longdesc><params name="speed" type="String, Number "><desc>A string representing one of the three predefined speeds (&quot;slow&quot;, &quot;normal&quot;, or &quot;fast&quot;) or the number of milliseconds to run the animation (e.g. 1000).</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the animation completes, executes once for each element animated against.
&lt;pre&gt;function callback() {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Animates all paragraphs to fade out, completing the animation within 600 milliseconds.</desc><code>

    $(&quot;p&quot;).click(function () {
      $(&quot;p&quot;).fadeOut(&quot;slow&quot;);
    });
</code><css>
  p { font-size:150%; cursor:pointer; }
  </css><html>&lt;p&gt;
    If you click on this paragraph
    you'll see it just fade away.
  &lt;/p&gt;</html></example><example><desc>Fades out spans in one section that you click on.</desc><code>

    $(&quot;span&quot;).click(function () {
      $(this).fadeOut(1000, function () {
        $(&quot;div&quot;).text(&quot;'&quot; + $(this).text() + &quot;' has faded!&quot;);
        $(this).remove();
      });
    });
    $(&quot;span&quot;).hover(function () {
      $(this).addClass(&quot;hilite&quot;);
    }, function () {
      $(this).removeClass(&quot;hilite&quot;);
    });

</code><css>
  span { cursor:pointer; }
  span.hilite { background:yellow; }
  div { display:inline; color:red; }
  </css><html>&lt;h3&gt;Find the modifiers - &lt;div&gt;&lt;/div&gt;&lt;/h3&gt;
  &lt;p&gt;
    If you &lt;span&gt;really&lt;/span&gt; want to go outside
    &lt;span&gt;in the cold&lt;/span&gt; then make sure to wear
    your &lt;span&gt;warm&lt;/span&gt; jacket given to you by
    your &lt;span&gt;favorite&lt;/span&gt; teacher.
  &lt;/p&gt;</html></example></method>
<method cat="Effects" name="fadeTo" return="jQuery" timestamp="2007-10-11T22:33:17Z"><added>1.0</added><desc>Fade the opacity of all matched elements to a specified opacity and firing an optional callback after completion.</desc><longdesc>Only the opacity is adjusted for this animation, meaning that all of the matched elements should already have some form of height and width associated with them.</longdesc><params name="speed" type="String, Number "><desc>A string representing one of the three predefined speeds (&quot;slow&quot;, &quot;normal&quot;, or &quot;fast&quot;) or the number of milliseconds to run the animation (e.g. 1000).</desc></params><params name="opacity" type="Number "><desc>The opacity to fade to (a number from 0 to 1).</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the animation completes, executed once for each element animated against.

&lt;pre&gt;function callback() {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Animates first paragraph to fade to an opacity of 0.33 (33%, about one third visible), completing the animation within 600 milliseconds.</desc><code>
    $(&quot;p:first&quot;).click(function () {
      $(this).fadeTo(&quot;slow&quot;, 0.33);
    });
</code><html>&lt;p&gt;
    Click this paragraph to see it fade.
  &lt;/p&gt;

  &lt;p&gt;
    Compare to this one that won't fade.
  &lt;/p&gt;</html></example><example><desc>Fade div to a random opacity on each click, completing the animation within 200 milliseconds.</desc><code>
    $(&quot;div&quot;).click(function () {
      $(this).fadeTo(&quot;fast&quot;, Math.random());
    });
</code><css>
  p { width:80px; margin:0; padding:5px; }
  div { width:40px; height:40px; position:absolute; }
  div#one { top:0; left:0; background:#f00; }
  div#two { top:20px; left:20px; background:#0f0; }
  div#three { top:40px; left:40px; background:#00f; }
  </css><html>&lt;p&gt;And this is the library that John built...&lt;/p&gt;

  &lt;div id=&quot;one&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;two&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;three&quot;&gt;&lt;/div&gt;</html></example><example><desc>Find the right answer!  The fade will take 250 milliseconds and change various styles when it completes.</desc><code>
    var getPos = function (n) {
      return (Math.floor(n) * 90) + &quot;px&quot;;
    };
    $(&quot;p&quot;).each(function (n) {
      var r = Math.floor(Math.random() * 3);
      var tmp = $(this).text();
      $(this).text($(&quot;p:eq(&quot; + r + &quot;)&quot;).text());
      $(&quot;p:eq(&quot; + r + &quot;)&quot;).text(tmp);
      $(this).css(&quot;left&quot;, getPos(n));
    });
    $(&quot;div&quot;).each(function (n) {
                  $(this).css(&quot;left&quot;, getPos(n));
                })
            .css(&quot;cursor&quot;, &quot;pointer&quot;)
            .click(function () {
                  $(this).fadeTo(250, 0.25, function () {
                        $(this).css(&quot;cursor&quot;, &quot;&quot;)
                               .prev().css({&quot;font-weight&quot;: &quot;bolder&quot;,
                                            &quot;font-style&quot;: &quot;italic&quot;});
                      });
                });

</code><css>
  div, p { width:80px; height:40px; top:0; margin:0; 
           position:absolute; padding-top:8px; }
  p { background:#fcc; text-align:center; }
  div { background:blue; }
  </css><html>&lt;p&gt;Wrong&lt;/p&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;p&gt;Wrong&lt;/p&gt;
  &lt;div&gt;&lt;/div&gt;

  &lt;p&gt;Right!&lt;/p&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></method>
<method cat="Effects" name="animate" return="jQuery" timestamp="2008-04-07T21:01:06Z"><added>1.0</added><desc>A function for making your own, custom animations...</desc><longdesc>The key aspect of this function is the object of style properties that will be animated, and to what end. Each key within the object represents a style property that will also be animated (for example: &quot;height&quot;, &quot;top&quot;, or &quot;opacity&quot;).

Note that properties should be specified using camel case eg. marginLeft instead of margin-left.

The value associated with the key represents to what end the property will be animated. If a number is provided as the value, then the style property will be transitioned from its current state to that new number. Otherwise if the string &quot;hide&quot;, &quot;show&quot;, or &quot;toggle&quot; is provided, a default animation will be constructed for that property.  Only properties that take numeric values are supported (e.g. backgroundColor is not supported by animate()).

As of jQuery 1.2 you can now animate properties by em and % (where applicable). Additionally, in jQuery 1.2, you can now do relative animations - specifying a &quot;''+=''&quot; or &quot;''-=''&quot; in front of the property value to move the element positively, or negatively, relative to the current position.</longdesc><params name="params" type="Options"><desc>A set of style attributes that you wish to animate, and to what end.</desc></params><params name="duration" optional="true" type="String, Number "><desc>A string representing one of the three predefined speeds (&quot;slow&quot;, &quot;normal&quot;, or &quot;fast&quot;) or the number of milliseconds to run the animation (e.g. 1000).</desc></params><params name="easing" optional="true" type="String "><desc>The name of the easing effect that you want to use (Plugin Required). There are two built-in values, &quot;linear&quot; and &quot;swing&quot;.</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the animation completes, executes once for each element animated against.</desc></params><example><desc>Click the button to animate the div with a number of different properties.</desc><code>

    // Using multiple unit types within one animation.
    $(&quot;#go&quot;).click(function(){
      $(&quot;#block&quot;).animate({ 
        width: &quot;70%&quot;,
        opacity: 0.4,
        marginLeft: &quot;0.6in&quot;,
        fontSize: &quot;3em&quot;, 
        borderWidth: &quot;10px&quot;
      }, 1500 );
    });
</code><html>&lt;button id=&quot;go&quot;&gt;&amp;raquo; Run&lt;/button&gt;

  &lt;div id=&quot;block&quot;&gt;Hello!&lt;/div&gt;</html><css>
  div { 
    background-color:#bca; 
    width:100px; 
    border:1px solid green;
  }
  </css></example><example><desc>Shows a div animate with a relative move.  Click several times on the buttons to see the relative animations queued up.</desc><code>
    $(&quot;#right&quot;).click(function(){
      $(&quot;.block&quot;).animate({&quot;left&quot;: &quot;+=50px&quot;}, &quot;slow&quot;);
    });

    $(&quot;#left&quot;).click(function(){
      $(&quot;.block&quot;).animate({&quot;left&quot;: &quot;-=50px&quot;}, &quot;slow&quot;);
    });

</code><html>&lt;button id=&quot;left&quot;&gt;&amp;laquo;&lt;/button&gt; &lt;button id=&quot;right&quot;&gt;&amp;raquo;&lt;/button&gt;
&lt;div class=&quot;block&quot;&gt;&lt;/div&gt;
</html><css>
  div { 
    position:absolute; 
    background-color:#abc; 
    left:50px;
    width:90px; 
    height:90px;
    margin:5px; 
  }
  </css></example><example><desc>Animates all paragraphs to toggle both height and opacity, completing the animation within 600 milliseconds.</desc><code>$(&quot;p&quot;).animate({
      &quot;height&quot;: &quot;toggle&quot;, &quot;opacity&quot;: &quot;toggle&quot;

    }, &quot;slow&quot;);</code></example><example><desc>Animates all paragraph to a left style of 50 and opacity of 1 (opaque, visible), completing the animation within 500 milliseconds.</desc><code>$(&quot;p&quot;).animate({
      &quot;left&quot;: &quot;50&quot;, &quot;opacity&quot;: 1
    }, 500);
</code></example><example><desc>An example of using an 'easing' function to provide a different style of animation. This will only work if you have a plugin that provides this easing function.  Note, this code will do nothing unless the paragraph element is hidden.</desc><code>$(&quot;p&quot;).animate({
      &quot;opacity&quot;: &quot;show&quot;

    }, &quot;slow&quot;, &quot;easein&quot;);</code></example></method>
<method cat="Effects" name="animate" return="jQuery" timestamp="2008-04-07T21:01:06Z"><added>1.0</added><desc>A function for making your own, custom animations.</desc><longdesc>The key aspect of this function is the object of style properties that will be animated, and to what end. Each key within the object represents a style property that will also be animated (for example: &quot;height&quot;, &quot;top&quot;, or &quot;opacity&quot;).

Note that properties should be specified using camel case eg. marginLeft instead of margin-left.

The value associated with the key represents to what end the property will be animated. If a number is provided as the value, then the style property will be transitioned from its current state to that new number. Otherwise if the string &quot;hide&quot;, &quot;show&quot;, or &quot;toggle&quot; is provided, a default animation will be constructed for that property. </longdesc><params name="params" type="Options"><desc>A set of style attributes that you wish to animate, and to what end.</desc></params><params name="options" type="Options "><desc>A set of options with which to configure the animation.</desc></params><option default="&quot;normal&quot;" name="duration" type="String, Number"><desc>A string representing one of the three predefined speeds (&quot;slow&quot;, &quot;normal&quot;, or &quot;fast&quot;) or the number of milliseconds to run the animation (e.g. 1000).</desc></option><option default="&quot;swing&quot;" name="easing" type="String"><desc>The name of the easing effect that you want to use (Plugin Required). There are two built-in values, &quot;linear&quot; and &quot;swing&quot;.</desc></option><option name="complete" type="Function"><desc>A function to be executed whenever the animation completes, executes once for each element animated against.</desc></option><option name="step" type="Callback"><desc></desc></option><option default="true" name="queue" type="Boolean"><desc>Setting this to false will make the animation skip the queue and will begin running immediately. (Added in jQuery 1.2)</desc></option><example><desc>The first button shows how an unqueued animation works.  It expands the div out to 90% width '''while''' the font-size is increasing. Once the font-size change is complete, the border animation will begin.

The second button starts a traditional chained animation, where each animation will start once the previous animation on the element has completed.</desc><code>

    $(&quot;#go1&quot;).click(function(){
      $(&quot;#block1&quot;).animate( { width:&quot;90%&quot; }, { queue:false, duration:3000 } )
         .animate( { fontSize:&quot;24px&quot; }, 1500 )
         .animate( { borderRightWidth:&quot;15px&quot; }, 1500);
    });

    $(&quot;#go2&quot;).click(function(){
      $(&quot;#block2&quot;).animate( { width:&quot;90%&quot;}, 1000 )
         .animate( { fontSize:&quot;24px&quot; } , 1000 )
         .animate( { borderLeftWidth:&quot;15px&quot; }, 1000);
    });

    $(&quot;#go3&quot;).click(function(){
      $(&quot;#go1&quot;).add(&quot;#go2&quot;).click();
    });

    $(&quot;#go4&quot;).click(function(){
      $(&quot;div&quot;).css({width:&quot;&quot;, fontSize:&quot;&quot;, borderWidth:&quot;&quot;});
    });

</code><html>&lt;button id=&quot;go1&quot;&gt;&amp;raquo; Animate Block1&lt;/button&gt;
  &lt;button id=&quot;go2&quot;&gt;&amp;raquo; Animate Block2&lt;/button&gt;
  &lt;button id=&quot;go3&quot;&gt;&amp;raquo; Animate Both&lt;/button&gt;

  &lt;button id=&quot;go4&quot;&gt;&amp;raquo; Reset&lt;/button&gt;
  &lt;div id=&quot;block1&quot;&gt;Block1&lt;/div&gt;
  &lt;div id=&quot;block2&quot;&gt;Block2&lt;/div&gt;</html><css>div { 
    background-color:#bca; 
    width:200px;
    height:1.1em;
    text-align:center;
    border:2px solid green;
    margin:3px;
    font-size:14px;
  }
  button {
    font-size:14px;
  }
  </css></example><example><desc>Animates all paragraphs to toggle both height and opacity, completing the animation within 600 milliseconds.</desc><code>$(&quot;p&quot;).animate({
      &quot;height&quot;: &quot;toggle&quot;, &quot;opacity&quot;: &quot;toggle&quot;

    }, { duration: &quot;slow&quot; });</code></example><example><desc>Animates all paragraph to a left style of 50 and opacity of 1 (opaque, visible), completing the animation within 500 milliseconds.  It also will do it ''outside'' the queue, meaning it will automatically start without waiting for its turn.</desc><code>$(&quot;p&quot;).animate({
      left: &quot;50px&quot;, opacity: 1
    }, { duration: 500, queue: false });</code></example><example><desc>An example of using an 'easing' function to provide a different style of animation. This will only work if you have a plugin that provides this easing function.</desc><code>$(&quot;p&quot;).animate({
      &quot;opacity&quot;: &quot;show&quot;

    }, { &quot;duration&quot;: &quot;slow&quot;, &quot;easing&quot;: &quot;easein&quot; });</code></example></method>
<method cat="Effects" name="stop" return="jQuery" timestamp="2007-10-11T22:20:50Z"><added>1.2</added><desc>Stops all the currently running animations on all the specified elements. </desc><longdesc>If any animations are queued to run, then they will begin immediately.</longdesc><example><desc>Click the Go button once to start the animation, then click the STOP button to stop it where it's currently positioned.  Another option is to click several buttons to queue them up and see that stop just kills the currently playing one.</desc><code>
    // Start animation
    $(&quot;#go&quot;).click(function(){
      $(&quot;.block&quot;).animate({left: '+=100px'}, 2000);
    });

    // Stop animation when button is clicked
    $(&quot;#stop&quot;).click(function(){
      $(&quot;.block&quot;).stop();
    });

    // Start animation in the opposite direction
    $(&quot;#back&quot;).click(function(){
      $(&quot;.block&quot;).animate({left: '-=100px'}, 2000);
    });

</code><html>&lt;button id=&quot;go&quot;&gt;Go&lt;/button&gt; 
  &lt;button id=&quot;stop&quot;&gt;STOP!&lt;/button&gt;
  &lt;button id=&quot;back&quot;&gt;Back&lt;/button&gt;
  &lt;div class=&quot;block&quot;&gt;&lt;/div&gt;</html><css>div { 
    position: absolute; 
    background-color: #abc;
    left: 0px;
    top:30px;
    width: 60px; 
    height: 60px;
    margin: 5px; 
  }
  </css></example></method>
<method cat="Effects" name="queue" return="Array&lt;Function&gt;" timestamp="2007-11-29T03:14:52Z"><added>1.2</added><desc>Returns a reference to the first element's queue (which is an array of functions).</desc><longdesc></longdesc><example><desc>Show the length of the queue.</desc><code>

    $(&quot;#show&quot;).click(function () {
      var n = $(&quot;div&quot;).queue(&quot;fx&quot;);
      $(&quot;span&quot;).text(&quot;Queue length is: &quot; + n.length);
    });
    function runIt() {
      $(&quot;div&quot;).show(&quot;slow&quot;);
      $(&quot;div&quot;).animate({left:'+=200'},2000);
      $(&quot;div&quot;).slideToggle(1000);
      $(&quot;div&quot;).slideToggle(&quot;fast&quot;);
      $(&quot;div&quot;).animate({left:'-=200'},1500);
      $(&quot;div&quot;).hide(&quot;slow&quot;);
      $(&quot;div&quot;).show(1200);
      $(&quot;div&quot;).slideUp(&quot;normal&quot;, runIt);
    }
    runIt();

</code><css>
  div { margin:3px; width:40px; height:40px;
        position:absolute; left:0px; top:30px; 
        background:green; display:none; }
  div.newcolor { background:blue; }
  span { color:red; }
  </css><html>&lt;button id=&quot;show&quot;&gt;Show Length of Queue&lt;/button&gt;
  &lt;span&gt;&lt;/span&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></method>
<method cat="Effects" name="queue" return="jQuery" timestamp="2007-11-29T03:14:52Z"><added>1.2</added><desc>Adds a new function, to be executed, onto the end of the queue of all matched elements.</desc><longdesc></longdesc><params name="callback" type="Function"><desc>The function to add to the queue.

&lt;pre&gt;function callback() {
  this; // dom element
  // to continue the queue you must call
  jQuery(this).dequeue();
}
&lt;/pre&gt;</desc></params><example><desc>Queue a custom function.</desc><code>
    $(document.body).click(function () {
      $(&quot;div&quot;).show(&quot;slow&quot;);
      $(&quot;div&quot;).animate({left:'+=200'},2000);
      $(&quot;div&quot;).queue(function () {
        $(this).addClass(&quot;newcolor&quot;);
        $(this).dequeue();
      });
      $(&quot;div&quot;).animate({left:'-=200'},500);
      $(&quot;div&quot;).queue(function () {
        $(this).removeClass(&quot;newcolor&quot;);
        $(this).dequeue();
      });
      $(&quot;div&quot;).slideUp();
    });

</code><css>
  div { margin:3px; width:40px; height:40px;
        position:absolute; left:0px; top:30px; 
        background:green; display:none; }
  div.newcolor { background:blue; }
  </css><html>Click here...
  &lt;div&gt;&lt;/div&gt;</html></example></method>
<method cat="Effects" name="queue" return="jQuery" timestamp="2007-11-29T03:14:52Z"><added>1.2</added><desc>Replaces the queue of all matched element with this new queue (the array of functions).</desc><longdesc></longdesc><params name="queue" type="Array&lt;Function&gt;"><desc>The queue to replace all the queues with.  The functions have the same parameters and this value as queue(callback).</desc></params><example><desc>Set a queue array to delete the queue.</desc><code>
    $(&quot;#start&quot;).click(function () {
      $(&quot;div&quot;).show(&quot;slow&quot;);
      $(&quot;div&quot;).animate({left:'+=200'},5000);
      $(&quot;div&quot;).queue(function () {
        $(this).addClass(&quot;newcolor&quot;);
        $(this).dequeue();
      });
      $(&quot;div&quot;).animate({left:'-=200'},1500);
      $(&quot;div&quot;).queue(function () {
        $(this).removeClass(&quot;newcolor&quot;);
        $(this).dequeue();
      });
      $(&quot;div&quot;).slideUp();
    });
    $(&quot;#stop&quot;).click(function () {
      $(&quot;div&quot;).queue(&quot;fx&quot;, []);
      $(&quot;div&quot;).stop();
    });

</code><css>
  div { margin:3px; width:40px; height:40px;
        position:absolute; left:0px; top:30px; 
        background:green; display:none; }
  div.newcolor { background:blue; }
  </css><html>&lt;button id=&quot;start&quot;&gt;Start&lt;/button&gt;
  &lt;button id=&quot;stop&quot;&gt;Stop&lt;/button&gt;
  &lt;div&gt;&lt;/div&gt;</html></example></method>
<method cat="Effects" name="dequeue" return="jQuery" timestamp="2007-10-11T22:13:19Z"><added>1.2</added><desc>Removes a queued function from the front of the queue and executes it.</desc><longdesc></longdesc><example><desc>Use dequeue to end a custom queue function which allows the queue to keep going.</desc><code>

    $(&quot;button&quot;).click(function () {
      $(&quot;div&quot;).animate({left:'+=200px'}, 2000);
      $(&quot;div&quot;).animate({top:'0px'}, 600);
      $(&quot;div&quot;).queue(function () {
        $(this).toggleClass(&quot;red&quot;);
        $(this).dequeue();
      });
      $(&quot;div&quot;).animate({left:'10px', top:'30px'}, 700);
    });
</code><css>
  div { margin:3px; width:50px; position:absolute;
        height:50px; left:10px; top:30px; 
        background-color:yellow; }
  div.red { background-color:red; }
  </css><html>&lt;button&gt;Start&lt;/button&gt;

  &lt;div&gt;&lt;/div&gt;</html></example></method>

<method cat="Ajax" name="jQuery.ajax" return="XMLHttpRequest" timestamp="2008-05-15T06:01:17Z"><added>1.0</added><desc>Load a remote page using an HTTP request.</desc><longdesc>This is jQuery's low-level AJAX implementation. See $.get, $.post etc. for higher-level abstractions that are often easier to understand and use, but don't offer as much functionality (such as error callbacks).

$.ajax() returns the XMLHttpRequest that it creates. In most cases you won't need that object to manipulate directly, but it is available if you need to abort the request manually.

$.ajax() takes one argument, an object of key/value pairs, that are used to initialize and handle the request. See below for a full list of the key/values that can be used.

'''Note:''' If you specify the dataType option described below, make sure
the server sends the correct MIME type in the response (eg. xml as &quot;text/xml&quot;).
Sending the wrong MIME type can lead to unexpected problems in your script.
See <![CDATA[<a href='Specifying_the_Data_Type_for_AJAX_Requests'>Specifying the Data Type for AJAX Requests</a>]]> for more information.

'''Note:''' All remote (not on the same domain) POST requests are converted to GET when 'script' is the dataType (because it loads script using a DOM script tag).

As of jQuery 1.2, you can load JSON data located on another domain if you specify a [http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/ JSONP] callback, which can be done like so: &quot;myurl?callback=?&quot;. jQuery automatically replaces the ? with the correct method name to call, calling your specified callback. Or, if you set the dataType to &quot;jsonp&quot; a callback will be automatically added to your Ajax request.</longdesc><params name="options" type="Options"><desc>A set of key/value pairs that configure the Ajax request. All options are optional. A default can be set for any option with <![CDATA[<a href='Ajax/jQuery.ajaxSetup'>$.ajaxSetup</a>]]>().</desc></params><option default="true" name="async" type="Boolean"><desc>By default, all requests are sent asynchronous (e.g. this is set to true by default). If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active.</desc></option><option name="beforeSend" type="Function"><desc>A pre-callback to modify the XMLHttpRequest object before it is sent. Use this to set custom headers etc. The XMLHttpRequest is passed as the only argument. This is an <![CDATA[<a href='Ajax_Events'>Ajax Event</a>]]>.

&lt;pre&gt;function (XMLHttpRequest) {
  this; // the options for this ajax request
}
&lt;/pre&gt;</desc></option><option default="true, false for dataType &quot;script&quot;" name="cache" type="Boolean"><desc>Added in jQuery 1.2, if set to false it will force the pages that you request to not be cached by the browser.</desc></option><option name="complete" type="Function"><desc>A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The XMLHttpRequest object and a string describing the type of success of the request. This is an <![CDATA[<a href='Ajax_Events'>Ajax Event</a>]]>.
&lt;pre&gt;function (XMLHttpRequest, textStatus) {
  this; // the options for this ajax request
}
&lt;/pre&gt;</desc></option><option default="&quot;application/x-www-form-urlencoded&quot;" name="contentType" type="String"><desc>When sending data to the server, use this content-type. Default is &quot;application/x-www-form-urlencoded&quot;, which is fine for most cases.</desc></option><option name="data" type="Object, String"><desc>Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key i.e. {foo:[&quot;bar1&quot;, &quot;bar2&quot;]} becomes '&amp;foo=bar1&amp;foo=bar2'.</desc></option><option default="Intelligent Guess (xml or html)" name="dataType" type="String"><desc>The type of data that you're expecting back from the server. If none is specified, jQuery will intelligently pass either responseXML or responseText to your success callback, based on the MIME type of the response. The available types (and the result passed as the first argument to your success callback) are:
*&quot;xml&quot;: Returns a XML document that can be processed via jQuery.
*&quot;html&quot;: Returns HTML as plain text; included script tags are evaluated when inserted in the DOM.
*&quot;script&quot;: Evaluates the response as JavaScript and returns it as plain text. Disables caching unless option &quot;cache&quot; is used. '''Note:''' This will turn POSTs into GETs for remote-domain requests.
*&quot;json&quot;: Evaluates the response as JSON and returns a JavaScript Object.
*&quot;jsonp&quot;: Loads in a JSON block using [http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/ JSONP]. Will add an extra &quot;?callback=?&quot; to the end of your URL to specify the callback. (Added in jQuery 1.2)
*&quot;text&quot;: A plain text string.</desc></option><option name="error" type="Function"><desc>A function to be called if the request fails. The function gets passed three arguments: The XMLHttpRequest object, a string describing the type of error that occurred and an optional exception object, if one occurred. This is an <![CDATA[<a href='Ajax_Events'>Ajax Event</a>]]>.

&lt;pre&gt;function (XMLHttpRequest, textStatus, errorThrown) {
  // typically only one of textStatus or errorThrown 
  // will have info
  this; // the options for this ajax request
}
&lt;/pre&gt;</desc></option><option default="true" name="global" type="Boolean"><desc>Whether to trigger global AJAX event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various <![CDATA[<a href='Ajax_Events'>Ajax Events</a>]]>.</desc></option><option default="false" name="ifModified" type="Boolean"><desc>Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header.</desc></option><option name="jsonp" type="String"><desc>Override the callback function name in a jsonp request.  This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url for a GET or the data for a POST.  So {jsonp:'onJsonPLoad'} would result in 'onJsonPLoad=?' passed to the server.</desc></option><option name="password" type="String"><desc>A password to be used in response to an HTTP access authentication request.</desc></option><option default="true" name="processData" type="Boolean"><desc>By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type &quot;application/x-www-form-urlencoded&quot;. If you want to send DOMDocuments, or other non-processed data, set this option to false.</desc></option><option name="success" type="Function"><desc>A function to be called if the request succeeds. The function gets passed two arguments: The data returned from the server, formatted according to the 'dataType' parameter, and a string describing the status. This is an <![CDATA[<a href='Ajax_Events'>Ajax Event</a>]]>.
&lt;pre&gt;function (data, textStatus) {
  // data could be xmlDoc, jsonObj, html, text, etc...
  this; // the options for this ajax request
}
&lt;/pre&gt;</desc></option><option name="timeout" type="Number"><desc>Set a local timeout in ms for the request. This will override the global timeout, if one is set via <![CDATA[<a href='Ajax/jQuery.ajaxSetup'>$.ajaxSetup</a>]]>. For example, you could use this property to give a single request a longer timeout than all other requests that you've set to time out in one second. See <![CDATA[<a href='Ajax/jQuery.ajaxSetup'>$.ajaxSetup</a>]]>() for global timeouts.</desc></option><option default="&quot;GET&quot;" name="type" type="String"><desc>The type of request to make (&quot;POST&quot; or &quot;GET&quot;), default is &quot;GET&quot;. Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.</desc></option><option default="The current page" name="url" type="String"><desc>The URL to request.</desc></option><option name="username" type="String"><desc>A username to be used in response to an HTTP access authentication request.</desc></option><example><desc>Load and execute a JavaScript file.</desc><code> $.ajax({
   type: &quot;GET&quot;,
   url: &quot;test.js&quot;,
   dataType: &quot;script&quot;

 });</code></example><example><desc>Save some data to the server and notify the user once its complete.</desc><code> $.ajax({
   type: &quot;POST&quot;,
   url: &quot;some.php&quot;,
   data: &quot;name=John&amp;location=Boston&quot;,
   success: function(msg){
     alert( &quot;Data Saved: &quot; + msg );
   }
 });</code></example><example><desc>Retrieve the latest version of an HTML page.</desc><code>$.ajax({
  url: &quot;test.html&quot;,
  cache: false,
  success: function(html){
    $(&quot;#results&quot;).append(html);
  }
});</code></example><example><desc>Loads data synchronously. Blocks the browser while the requests is active.
It is better to block user interaction by other means when synchronization is
necessary.</desc><code> var html = $.ajax({
  url: &quot;some.php&quot;,
  async: false
 }).responseText;</code></example><example><desc>Sends an xml document as data to the server. By setting the processData
option to false, the automatic conversion of data to strings is prevented.</desc><code> var xmlDocument = [create xml document];
 $.ajax({
   url: &quot;page.php&quot;,
   processData: false,
   data: xmlDocument,
   success: handleResponse
 });</code></example></method>
<method cat="Ajax" name="load" return="jQuery" timestamp="2008-04-01T05:53:00Z"><added>1.0</added><desc>Load HTML from a remote file and inject it into the DOM.</desc><longdesc>A GET request will be performed by default - but if you pass in any extra parameters then a POST will occur.

In jQuery 1.2 you can now specify a jQuery selector in the URL. Doing so will filter the incoming HTML document, only injecting the elements that match the selector. The syntax looks something like &quot;url #some &gt; selector&quot;. See the examples for more information.</longdesc><params name="url" type="String"><desc>The URL of the HTML page to load.</desc></params><params name="data" optional="true
" type="Map"><desc>Key/value pairs that will be sent to the server.</desc></params><params name="callback" type="Callback"><desc>The function called when the ajax request is complete (not necessarily success).

&lt;pre&gt;function (responseText, textStatus, XMLHttpRequest) {
  this; // dom element
}
&lt;/pre&gt;</desc></params><example><desc>Load a piece of the documentation sidebar navigation into a custom unordered list.</desc><code>$(&quot;#links&quot;).load(&quot;/Main_Page #p-Getting-Started li&quot;);</code><css>body{ font-size: 11px; font-family: Arial; }</css><html>&lt;b&gt;jQuery Links:&lt;/b&gt;
&lt;ul id=&quot;links&quot;&gt;&lt;/ul&gt;</html></example><example><desc>Load the feeds.html file into the div with the ID of feeds.</desc><code>$(&quot;#feeds&quot;).load(&quot;feeds.html&quot;);</code><results>&lt;div id=&quot;feeds&quot;&gt;&lt;b&gt;45&lt;/b&gt; feeds found.&lt;/div&gt;</results></example><example><desc>Same as above, but will POST the additional parameters to the server and a callback that is executed when the server is finished responding.</desc><code> $(&quot;#feeds&quot;).load(&quot;feeds.php&quot;, {limit: 25}, function(){
   alert(&quot;The last 25 entries in the feed have been loaded&quot;);
 });</code></example></method>
<method cat="Ajax" name="jQuery.get" return="XMLHttpRequest" timestamp="2007-10-31T04:03:18Z"><added>1.0</added><desc>Load a remote page using an HTTP GET request.</desc><longdesc>This is an easy way to send a simple GET request to a server without having to use the more complex $.ajax function. It allows a single callback function to be specified that will be executed when the request is complete (and only if the response has a successful response code). If you need to have both error and success callbacks, you may want to use $.ajax.</longdesc><params name="url" type="String"><desc>The URL of the page to load.</desc></params><params name="data" optional="true" type="Map"><desc>Key/value pairs that will be sent to the server.</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the data is loaded successfully.

&lt;pre&gt;function (data, textStatus) {
  // data could be xmlDoc, jsonObj, html, text, etc...
  this; // the options for this ajax request
}
&lt;/pre&gt;</desc></params><example><desc>Request the test.php page, but ignore the return results.</desc><code> $.get(&quot;test.php&quot;);</code></example><example><desc>Request the test.php page and send some additional data along (while still ignoring the return results).</desc><code> $.get(&quot;test.php&quot;, { name: &quot;John&quot;, time: &quot;2pm&quot; } );</code></example><example><desc>Alert out the results from requesting test.php (HTML or XML, depending on what was returned).</desc><code> $.get(&quot;test.php&quot;, function(data){
   alert(&quot;Data Loaded: &quot; + data);
 });</code></example><example><desc>Alert out the results from requesting test.cgi with an additional payload of data (HTML or XML, depending on what was returned).</desc><code> $.get(&quot;test.cgi&quot;, { name: &quot;John&quot;, time: &quot;2pm&quot; },
   function(data){
     alert(&quot;Data Loaded: &quot; + data);
   });</code></example></method>
<method cat="Ajax" name="jQuery.getJSON" return="XMLHttpRequest" timestamp="2008-05-14T09:35:15Z"><added>1.0</added><desc>Load JSON data using an HTTP GET request.</desc><longdesc>As of jQuery 1.2, you can load JSON data located on another domain if you specify a [http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/ JSONP] callback, which can be done like so: &quot;myurl?callback=?&quot;. jQuery automatically replaces the ? with the correct method name to call, calling your specified callback.


Note: Keep in mind, that lines after this function will be executed before callback.</longdesc><params name="url" type="String"><desc>The URL of the page to load.</desc></params><params name="data" optional="true" type="Map"><desc>Key/value pairs that will be sent to the server.</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the data is loaded successfully.

&lt;pre&gt;function (data, textStatus) {
  // data will be a jsonObj
  this; // the options for this ajax request
}
&lt;/pre&gt;</desc></params><example><desc>Loads the four most recent cat pictures from the Flickr JSONP API.</desc><code>$.getJSON(&quot;http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&amp;tagmode=any&amp;format=json&amp;jsoncallback=?&quot;,
        function(data){
          $.each(data.items, function(i,item){
            $(&quot;&lt;img/&gt;&quot;).attr(&quot;src&quot;, item.media.m).appendTo(&quot;#images&quot;);
            if ( i == 3 ) return false;
          });
        });</code><html>&lt;div id=&quot;images&quot;&gt;&lt;/div&gt;</html><css>img{ height: 100px; float: left; }</css></example><example><desc>Load the JSON data from test.js and access a name from the returned JSON data.</desc><code> $.getJSON(&quot;test.js&quot;, function(json){
   alert(&quot;JSON Data: &quot; + json.users[3].name);
 });</code></example><example><desc>Load the JSON data from test.js, passing along additional data, and access a name from the returned JSON data.</desc><code> $.getJSON(&quot;test.js&quot;, { name: &quot;John&quot;, time: &quot;2pm&quot; }, function(json){
   alert(&quot;JSON Data: &quot; + json.users[3].name);
 });</code></example><example><desc>List the result of a consultation of pages.php in HTML as an array. By Manuel Gonzalez.</desc><code>

var id=$(&quot;#id&quot;).attr(&quot;value&quot;);
  $.getJSON(&quot;pages.php&quot;,{id:id},dates);
function dates(datos)
{
	
 $(&quot;#list&quot;).html(&quot;Name:&quot;+datos[1].name+&quot;&lt;br&gt;&quot;+&quot;Last Name:&quot;+datos[1].lastname+&quot;&lt;br&gt;&quot;+&quot;Address:&quot;+datos[1].address);
}

</code></example></method>
<method cat="Ajax" name="jQuery.getScript" return="XMLHttpRequest" timestamp="2007-10-31T03:52:12Z"><added>1.0</added><desc>Loads, and executes, a local JavaScript file using an HTTP GET request.</desc><longdesc>Before jQuery 1.2, getScript was only able to load scripts from the same domain as the original page. As of 1.2, you can now load JavaScript files from any domain.

Warning: Safari 2 and older is unable to evaluate scripts in a global context synchronously. If you load functions via getScript, make sure to call them after a delay.</longdesc><params name="url" type="String"><desc>The URL of the page to load.</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the data is loaded successfully.
&lt;pre&gt;function (data, textStatus) {
  // data should be javascript
  this; // the options for this ajax request
}
&lt;/pre&gt;</desc></params><example><desc>We load the new [http://jquery.com/plugins/project/color official jQuery Color Animation plugin] dynamically and bind some color animations to occur once the new functionality is loaded.</desc><code>$.getScript(&quot;http://dev.jquery.com/view/trunk/plugins/color/jquery.color.js&quot;, function(){
  $(&quot;#go&quot;).click(function(){
    $(&quot;.block&quot;).animate( { backgroundColor: 'pink' }, 1000)
      .animate( { backgroundColor: 'blue' }, 1000);
  });
});</code><html>&lt;button id=&quot;go&quot;&gt;&amp;raquo; Run&lt;/button&gt;

&lt;div class=&quot;block&quot;&gt;&lt;/div&gt;
</html><css>.block { 
   background-color: blue; 
   width: 150px; 
   height: 70px;
   margin: 10px; 
}</css></example><example><desc>Load the test.js JavaScript file and execute it.</desc><code> $.getScript(&quot;test.js&quot;);</code></example><example><desc>Load the test.js JavaScript file and execute it, displaying an alert message when the execution is complete.</desc><code> $.getScript(&quot;test.js&quot;, function(){
   alert(&quot;Script loaded and executed.&quot;);
 });</code></example></method>
<method cat="Ajax" name="jQuery.post" return="XMLHttpRequest" timestamp="2008-05-30T15:32:38Z"><added>1.0</added><desc>Load a remote page using an HTTP POST request.</desc><longdesc>This is an easy way to send a simple POST request to a server without having to use the more complex $.ajax function. It allows a single callback function to be specified that will be executed when the request is complete (and only if the response has a successful response code).
The returned data format can be specified by the fourth paramater.
If you need to have both error and success callbacks, you may want to use $.ajax. $.post is a (simplified) wrapper function for $.ajax.</longdesc><params name="url" type="String"><desc>The URL of the page to load.</desc></params><params name="data" optional="true" type="Map"><desc>Key/value pairs that will be sent to the server.</desc></params><params name="callback" optional="true" type="Function"><desc>A function to be executed whenever the data is loaded successfully.

&lt;pre&gt;function (data, textStatus) {
  // data could be xmlDoc, jsonObj, html, text, etc...
  this; // the options for this ajax request
}
&lt;/pre&gt;</desc></params><params name="type" optional="true" type="String"><desc>Type of data to be returned to callback function (JSON, XML, etc.)
&lt;pre&gt;$.postJSON = function(url, data, callback) {
	$.post(url, data, callback, &quot;json&quot;);
};
&lt;/pre&gt;</desc></params><example><desc>Request the test.php page, but ignore the return results.</desc><code> $.post(&quot;test.php&quot;);</code></example><example><desc>Request the test.php page and send some additional data along (while still ignoring the return results).</desc><code> $.post(&quot;test.php&quot;, { name: &quot;John&quot;, time: &quot;2pm&quot; } );</code></example><example><desc>Alert out the results from requesting test.php (HTML or XML, depending on what was returned).</desc><code> $.post(&quot;test.php&quot;, function(data){
   alert(&quot;Data Loaded: &quot; + data);
 });</code></example><example><desc>Alert out the results from requesting test.php with an additional payload of data (HTML or XML, depending on what was returned).</desc><code> $.post(&quot;test.cgi&quot;, { name: &quot;John&quot;, time: &quot;2pm&quot; },
   function(data){
     alert(&quot;Data Loaded: &quot; + data);
   });</code></example><example><desc>Gets the test.php page content, store it in a XMLHttpResponse object and applies the process() JavaScript function.</desc><code> $.post(&quot;test.php&quot;, { name: &quot;John&quot;, time: &quot;2pm&quot; },
   function(data){
     process(data);
   }, &quot;xml&quot;);</code></example><example><desc>Gets the test.php page contents which has been returned in json format (&lt;?php echo json_encode(array(&quot;name&quot;=&gt;&quot;John&quot;,&quot;time&quot;=&gt;&quot;2pm&quot;)); ?&gt;)

</desc><code> $.post(&quot;test.php&quot;, { func: &quot;getNameAndTime&quot; },
   function(data){
     alert(data.name); // John
     console.log(data.time); //  2pm
   }, &quot;json&quot;);</code></example></method>
<method cat="Ajax" name="ajaxComplete" return="jQuery" timestamp="2007-12-15T18:06:16Z"><added>1.0</added><desc>Attach a function to be executed whenever an AJAX request completes. This is an <![CDATA[<a href='Ajax_Events'>Ajax Event</a>]]>.</desc><longdesc>The XMLHttpRequest and settings used for that request are passed as arguments to the callback.</longdesc><params name="callback" type="Function"><desc>The function to execute.
&lt;pre&gt;function (event, XMLHttpRequest, ajaxOptions) {
  this; // dom element listening
}
&lt;/pre&gt;</desc></params><example><desc>Show a message when an AJAX request completes.</desc><code> $(&quot;#msg&quot;).ajaxComplete(function(request, settings){
   $(this).append(&quot;&lt;li&gt;Request Complete.&lt;/li&gt;&quot;);
 });</code></example></method>
<method cat="Ajax" name="ajaxError" return="jQuery" timestamp="2008-01-18T13:36:21Z"><added>1.0</added><desc>Attach a function to be executed whenever an AJAX request fails. This is an <![CDATA[<a href='Ajax_Events'>Ajax Event</a>]]>.</desc><longdesc>The XMLHttpRequest and settings used for that request are passed as arguments to the callback. A third argument, an exception object, is passed if an exception occured while processing the request.</longdesc><params name="callback" type="Function"><desc>The function to execute.

&lt;pre&gt;function (event, XMLHttpRequest, ajaxOptions, thrownError) {
  // thrownError only passed if an error was caught
  this; // dom element listening
}
&lt;/pre&gt;</desc></params><example><desc>Show a message when an AJAX request fails.</desc><code> $(&quot;#msg&quot;).ajaxError(function(event, request, settings){
   $(this).append(&quot;&lt;li&gt;Error requesting page &quot; + settings.url + &quot;&lt;/li&gt;&quot;);
 });</code></example></method>
<method cat="Ajax" name="ajaxSend" return="jQuery" timestamp="2007-12-15T18:07:20Z"><added>1.0</added><desc>Attach a function to be executed before an AJAX request is sent. This is an <![CDATA[<a href='Ajax_Events'>Ajax Event</a>]]>.</desc><longdesc>The XMLHttpRequest and settings used for that request are passed as arguments to the callback.</longdesc><params name="callback" type="Function"><desc>The function to execute.

&lt;pre&gt;function (event, XMLHttpRequest, ajaxOptions) {
  this; // dom element listening
}
&lt;/pre&gt;</desc></params><example><desc>Show a message before an AJAX request is sent.</desc><code> $(&quot;#msg&quot;).ajaxSend(function(evt, request, settings){
   $(this).append(&quot;&lt;li&gt;Starting request at &quot; + settings.url + &quot;&lt;/li&gt;&quot;);
 });</code></example></method>
<method cat="Ajax" name="ajaxStart" return="jQuery" timestamp="2007-10-31T03:36:33Z"><added>1.0</added><desc>Attach a function to be executed whenever an AJAX request begins and there is none already active. This is an <![CDATA[<a href='Ajax_Events'>Ajax Event</a>]]>.</desc><longdesc></longdesc><params name="callback" type="Function"><desc>The function to execute.

&lt;pre&gt;function () {
  this; // dom element listening
}
&lt;/pre&gt;</desc></params><example><desc>Show a loading message whenever an AJAX request starts (and none is already active).</desc><code> $(&quot;#loading&quot;).ajaxStart(function(){
   $(this).show();
 });</code></example></method>
<method cat="Ajax" name="ajaxStop" return="jQuery" timestamp="2007-10-31T03:35:25Z"><added>1.0</added><desc>Attach a function to be executed whenever all AJAX requests have ended. This is an <![CDATA[<a href='Ajax_Events'>Ajax Event</a>]]>.</desc><longdesc></longdesc><params name="callback" type="Function"><desc>The function to execute.
&lt;pre&gt;function () {
  this; // dom element listening
}
&lt;/pre&gt;</desc></params><example><desc>Hide a loading message after all the AJAX requests have stopped.</desc><code> $(&quot;#loading&quot;).ajaxStop(function(){
   $(this).hide();
 });</code></example></method>
<method cat="Ajax" name="ajaxSuccess" return="jQuery" timestamp="2007-12-15T18:08:19Z"><added>1.0</added><desc>Attach a function to be executed whenever an AJAX request completes successfully. This is an <![CDATA[<a href='Ajax_Events'>Ajax Event</a>]]>.</desc><longdesc>The event object, XMLHttpRequest, and settings used for that request are passed as arguments to the callback.</longdesc><params name="callback" type="Function"><desc>The function to execute.

&lt;pre&gt;function (event, XMLHttpRequest, ajaxOptions) {
  this; // dom element listening
}
&lt;/pre&gt;</desc></params><example><desc>Show a message when an AJAX request completes successfully.</desc><code> $(&quot;#msg&quot;).ajaxSuccess(function(evt, request, settings){
   $(this).append(&quot;&lt;li&gt;Successful Request!&lt;/li&gt;&quot;);
 });</code></example></method>
<method cat="Ajax" name="jQuery.ajaxSetup" return="" timestamp="2008-03-22T05:18:56Z"><added>1.1</added><desc>Setup global settings for AJAX requests.</desc><longdesc>See <![CDATA[<a href='Ajax/jQuery.ajax'>$.ajax</a>]]> for a description of all available options.</longdesc><params name="options" type="Options"><desc>A set of key/value pairs that configure the default Ajax request. All options are optional.</desc></params><example><desc>Sets the defaults for AJAX requests to the url &quot;/xmlhttp/&quot;, disables global handlers and uses POST instead of GET. The following AJAX requests then sends some data without having to set anything else.</desc><code> $.ajaxSetup({
   url: &quot;/xmlhttp/&quot;,
   global: false,
   type: &quot;POST&quot;

 });
 $.ajax({ data: myData });</code></example></method>
<method cat="Ajax" name="serialize" return="jQuery" timestamp="2007-10-30T23:09:40Z"><added>1.0</added><desc>Serializes a set of input elements into a string of data. This will serialize all given elements.</desc><longdesc>As of jQuery 1.2 the serialize method correctly serializes forms. For older versions of jQuery, the [http://www.malsup.com/jquery/form/ Form Plugin's] fieldSerialize method should be used.</longdesc><example><desc>Serialize a form to a query string, that could be sent to a server in an Ajax request.</desc><code>
    function showValues() {
      var str = $(&quot;form&quot;).serialize();
      $(&quot;#results&quot;).text(str);
    }

    $(&quot;:checkbox, :radio&quot;).click(showValues);
    $(&quot;select&quot;).change(showValues);
    showValues();

</code><css>
  body, select { font-size:12px; }
  form { margin:5px; }
  p { color:red; margin:5px; font-size:14px; }
  b { color:blue; }
  </css><html>&lt;form&gt;
    &lt;select name=&quot;single&quot;&gt;
      &lt;option&gt;Single&lt;/option&gt;
      &lt;option&gt;Single2&lt;/option&gt;

    &lt;/select&gt;
    &lt;select name=&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;check&quot; value=&quot;check1&quot;/&gt; check1
    &lt;input type=&quot;checkbox&quot; name=&quot;check&quot; value=&quot;check2&quot; checked=&quot;checked&quot;/&gt; check2
    &lt;input type=&quot;radio&quot; name=&quot;radio&quot; value=&quot;radio1&quot; checked=&quot;checked&quot;/&gt; radio1
    &lt;input type=&quot;radio&quot; name=&quot;radio&quot; value=&quot;radio2&quot;/&gt; radio2
  &lt;/form&gt;

  &lt;p&gt;&lt;tt id=&quot;results&quot;&gt;&lt;/tt&gt;&lt;/p&gt;</html></example></method>
<method cat="Ajax" name="serializeArray" return="jQuery" timestamp="2007-10-30T22:58:23Z"><added>1.2</added><desc>Serializes all forms and form elements (like the <![CDATA[<a href='Ajax/serialize'>.serialize()</a>]]> method) but returns a JSON data structure for you to work with.</desc><longdesc></longdesc><example><desc>Get the values from a form, iterate through them, and append them to a results display.</desc><code>
    function showValues() {
      var fields = $(&quot;:input&quot;).serializeArray();
      $(&quot;#results&quot;).empty();
      jQuery.each(fields, function(i, field){
        $(&quot;#results&quot;).append(field.value + &quot; &quot;);
      });
    }

    $(&quot;:checkbox, :radio&quot;).click(showValues);
    $(&quot;select&quot;).change(showValues);
    showValues();

</code><css>
  body, select { font-size:14px; }
  form { margin:5px; }
  p { color:red; margin:5px; }
  b { color:blue; }
  </css><html>&lt;p&gt;&lt;b&gt;Results:&lt;/b&gt; &lt;span id=&quot;results&quot;&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;form&gt;
    &lt;select name=&quot;single&quot;&gt;

      &lt;option&gt;Single&lt;/option&gt;
      &lt;option&gt;Single2&lt;/option&gt;
    &lt;/select&gt;
    &lt;select name=&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;check&quot; value=&quot;check1&quot;/&gt; check1
    &lt;input type=&quot;checkbox&quot; name=&quot;check&quot; value=&quot;check2&quot; checked=&quot;checked&quot;/&gt; check2
    &lt;input type=&quot;radio&quot; name=&quot;radio&quot; value=&quot;radio1&quot; checked=&quot;checked&quot;/&gt; radio1
    &lt;input type=&quot;radio&quot; name=&quot;radio&quot; value=&quot;radio2&quot;/&gt; radio2
  &lt;/form&gt;</html></example></method>
<property cat="Utilities" name="jQuery.browser" return="Map" timestamp="2007-10-11T23:22:48Z"><added>1.0</added><desc>Contains flags for the useragent, read from navigator.userAgent.</desc><longdesc>Available flags are:
* safari
* opera
* msie
* mozilla

This property is available before the DOM is ready, therefore you can use it to add ready events only for certain browsers.

There are situations where object detection is not reliable enough, in such cases it makes sense to use browser detection.

A combination of browser and object detection yields quite reliable results. </longdesc><example><desc>Show the browser info.</desc><code>

    jQuery.each(jQuery.browser, function(i, val) {
      $(&quot;&lt;div&gt;&quot; + i + &quot; : &lt;span&gt;&quot; + val + &quot;&lt;/span&gt;&quot;)
                .appendTo(document.body);
    });
</code><css>
  p { color:green; font-weight:bolder; margin:3px 0 0 10px; }
  div { color:blue; margin-left:20px; font-size:14px; }
  span { color:red; }
  </css><html>&lt;p&gt;Browser info:&lt;/p&gt;</html></example><example><desc>Returns true if the current useragent is some version of Microsoft's Internet Explorer</desc><code>$.browser.msie</code></example><example><desc>Alerts &quot;this is safari!&quot; only for safari browsers</desc><code>if ($.browser.safari) {
    alert(&quot;this is safari!&quot;);
 }</code></example></property><property cat="Utilities" name="jQuery.browser.version" return="String" timestamp="2007-11-20T19:14:58Z"><added>1.1.3</added><desc>The version number of the rendering engine for the user's browser.</desc><longdesc>Here are some typical results:
* Internet Explorer: 6.0, 7.0
* Mozilla/Firefox/Flock/Camino: 1.7.12, 1.8.1.3
* Opera: 9.20
* Safari/Webkit: 312.8, 418.9</longdesc><example><desc>Returns the browser version.</desc><code>

    $(&quot;p&quot;).html(&quot;The browser version is: &lt;span&gt;&quot; +
                jQuery.browser.version + &quot;&lt;/span&gt;&quot;);
</code><css>
  p { color:blue; margin:20px; }
  span { color:red; }
  </css><html>&lt;p&gt;
  &lt;/p&gt;</html></example><example><desc>Alerts the version of IE that is being used</desc><code>if ( $.browser.msie )
  alert( $.browser.version );
}</code></example><example><desc>Often you only care about the &quot;major number,&quot; the whole number. This can be accomplished with JavaScript's built-in parseInt() function:</desc><code>

if (jQuery.browser.msie) {
  alert(parseInt(jQuery.browser.version));
}
</code></example></property><property cat="Utilities" name="jQuery.boxModel" return="Boolean" timestamp="2007-10-11T23:16:10Z"><added>1.0</added><desc>States if the current page, in the user's browser, is being rendered using the [http://www.w3.org/TR/REC-CSS2/box.html W3C CSS Box Model].</desc><longdesc></longdesc><example><desc>Returns the box model for the iframe.</desc><code>

    $(&quot;p&quot;).html(&quot;The box model for this iframe is: &lt;span&gt;&quot; +
                jQuery.boxModel + &quot;&lt;/span&gt;&quot;);
</code><css>

  p { color:blue; margin:20px; }
  span { color:red; }
  </css><html>&lt;p&gt;
  &lt;/p&gt;</html></example><example><desc>Returns false if the page is in QuirksMode in Internet Explorer</desc><code>$.boxModel</code><results>false</results></example></property>
<method cat="Utilities" name="jQuery.each" return="Object" timestamp="2008-04-21T18:24:38Z"><added>1.0</added><desc>A generic iterator function, which can be used to seamlessly iterate over both objects and arrays.</desc><longdesc>This function is not the same as $().each() - which is used to iterate, exclusively, over a jQuery object. This function can be used to iterate over anything.

The callback has two arguments:the key (objects) or index (arrays) as the first, and the value as the second.

If you wish to break the each() loop at a particular iteration you can do so by making your function return false. Other return values are ignored.</longdesc><params name="object" type="Object"><desc>The object or array to iterate over.</desc></params><params name="callback" type="Function"><desc>The function that will be executed on every object.
&lt;pre&gt;function callback(indexInArray, valueOfElement) {
  var booleanKeepGoing;

  this; // == valueOfElement

  return booleanKeepGoing; // optional, unless false 
                           // and want to stop looping
}
&lt;/pre&gt;</desc></params><example><desc>Iterates through the array displaying each number as both a word and numeral</desc><code>

    var arr = [ &quot;one&quot;, &quot;two&quot;, &quot;three&quot;, &quot;four&quot;, &quot;five&quot; ];
    var obj = { one:1, two:2, three:3, four:4, five:5 };

    jQuery.each(arr, function() {
      $(&quot;#&quot; + this).text(&quot;My id is &quot; + this + &quot;.&quot;);
      return (this != &quot;four&quot;); // will stop running to skip &quot;five&quot;

    });

    jQuery.each(obj, function(i, val) {
      $(&quot;#&quot; + i).append(document.createTextNode(&quot; - &quot; + val));
    });
</code><css>
  div { color:blue; }
  div#five { color:red; }
  </css><html>&lt;div id=&quot;one&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;two&quot;&gt;&lt;/div&gt;

  &lt;div id=&quot;three&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;four&quot;&gt;&lt;/div&gt;
  &lt;div id=&quot;five&quot;&gt;&lt;/div&gt;</html></example><example><desc>Iterates over items in an array, accessing both the current item and its index.</desc><code> $.each( [0,1,2], function(i, n){
   alert( &quot;Item #&quot; + i + &quot;: &quot; + n );
 });</code></example><example><desc>Iterates over the properties in an object, accessing both the current item and its key.</desc><code>$.each( { name: &quot;John&quot;, lang: &quot;JS&quot; }, function(i, n){
   alert( &quot;Name: &quot; + i + &quot;, Value: &quot; + n );
 });</code></example></method>
<method cat="Utilities" name="jQuery.extend" return="Object" timestamp="2008-04-27T04:49:01Z"><added>1.0</added><desc>Extend one object with one or more others, returning the original, modified, object.</desc><longdesc>If no target is specified, the JQuery namespace itself is extended.  This can be useful for plugin authors wishing to add new methods to JQuery.

If a boolean false is specified as the first argument, JQuery performs a deep copy, recursively copying any objects it finds.  Otherwise, the copy will share structure with the original object(s).

Undefined properties are not copied.  However, properties inherited from the object's prototype ''will'' be copied over.</longdesc><params name="target" type="Object"><desc>The object to extend.</desc></params><params name="object1" type="Object"><desc>The object that will be merged into the first.</desc></params><params name="objectN" optional="true" type="Object"><desc>More objects to merge into the first.</desc></params><example><desc>Merge settings and options, modifying settings.</desc><code>var settings = { validate: false, limit: 5, name: &quot;foo&quot; };
var options = { validate: true, name: &quot;bar&quot; };
jQuery.extend(settings, options);</code><results>settings == { validate: true, limit: 5, name: &quot;bar&quot; }</results></example><example><desc>Merge defaults and options, without modifying the defaults.</desc><code>var empty = {}
var defaults = { validate: false, limit: 5, name: &quot;foo&quot; };
var options = { validate: true, name: &quot;bar&quot; };
var settings = $.extend(empty, defaults, options);</code><results>settings == { validate: true, limit: 5, name: &quot;bar&quot; }
empty == { validate: true, limit: 5, name: &quot;bar&quot; }</results></example></method>
<method cat="Utilities" name="jQuery.grep" return="Array" timestamp="2008-03-11T23:05:03Z"><added>1.0</added><desc>Filter items out of an array, by using a filter function.</desc><longdesc>The specified function will be passed two arguments: The current array item and the filter function. The function must return 'true' to keep the item in the array, false to remove it.</longdesc><params name="array" type="Array"><desc>The Array to find items in.</desc></params><params name="callback" type="Function"><desc>The function to process each item against.  The first argument to the function is the list item, and the second argument is the list index.  The function should return a Boolean value.  The &quot;lambda-form&quot; function feature was removed in jQuery 1.2.3 to help compatibility with other frameworks.

&lt;pre&gt;function callback(elementOfArray, indexInArray) {
  var shouldKeepIt;

  this; // unmapped

  return shouldKeepIt;
}
&lt;/pre&gt;</desc></params><params name="invert" optional="true" type="Boolean"><desc>If &quot;invert&quot; is false, or not provided, then the function returns an array consisting of all elements for which &quot;callback&quot; returns true.  If &quot;invert&quot; is true, then the function returns an array consisting of all elements for which &quot;callback&quot; returns false.</desc></params><example><desc>Filters the original array of numbers leaving that are not 5 and have an index greater than 3.  Then it removes all 9s while inverting it.</desc><code>

    var arr = [ 1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1 ];
    $(&quot;div&quot;).text(arr.join(&quot;, &quot;));

    arr = jQuery.grep(arr, function(n, i){
      return (n != 5 &amp;&amp; i &gt; 4);
    });
    $(&quot;p&quot;).text(arr.join(&quot;, &quot;));

    arr = jQuery.grep(arr, function (a) { return a != 9; });
    $(&quot;span&quot;).text(arr.join(&quot;, &quot;));

</code><css>
  div { color:blue; }
  p { color:green; margin:0; }
  span { color:red; }
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;p&gt;&lt;/p&gt;
  &lt;span&gt;&lt;/span&gt;
  </html></example><example><desc>Filter an array of numbers to include only numbers bigger then zero.</desc><code>$.grep( [0,1,2], function(n,i){
   return n &gt; 0;
 });</code><results>[1, 2]</results></example></method>
<method cat="Utilities" name="jQuery.makeArray" return="Array" timestamp="2007-10-30T04:54:31Z"><added>1.2</added><desc>Turns an array-like object into a true array.</desc><longdesc>Array-like objects have a length property and its properties are numbered from 0 to length - 1.  Typically it will be unnecessary to use this function if you are using jQuery which uses this function internally.</longdesc><params name="obj" type="Object"><desc>Array-like object to turn in to an actual Array.</desc></params><example><desc>Turn a collection of HTMLElements into an Array of them.</desc><code>

    var arr = jQuery.makeArray(document.getElementsByTagName(&quot;div&quot;));
    arr.reverse(); // use an Array method on list of dom elements
    $(arr).appendTo(document.body);
</code><css>
  div { color:red; }
  </css><html>&lt;div&gt;First&lt;/div&gt;
  &lt;div&gt;Second&lt;/div&gt;  
  &lt;div&gt;Third&lt;/div&gt;

  &lt;div&gt;Fourth&lt;/div&gt;</html></example></method>
<method cat="Utilities" name="jQuery.map" return="Array" timestamp="2008-05-24T03:59:01Z"><added>1.0</added><desc>Translate all items in an array to another array of items.</desc><longdesc>The translation function that is provided to this method is called for each item in the array and is passed two arguments: The item to be translated, and its index within the array.

The function can then return the translated value, 'null' (to remove the item), or an array of values - which will be flattened into the full array. </longdesc><params name="array" type="Array"><desc>The Array to translate.</desc></params><params name="callback" type="Function"><desc>The function to process each item against.  The argument to the function is the list item. The function can return any value.  The &quot;lambda-form&quot; function represented as a string no longer works.  It was removed in version 1.2.3 to increase compatibility with Adobe AIR.   
&lt;pre&gt;function callback(elementOfArray, indexInArray) {
  var replacementValue;

  this; // unmapped

  return replacementValue;
}
&lt;/pre&gt;</desc></params><example><desc>A couple examples of using .map()</desc><code>

    var arr = [ &quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot; ]
    $(&quot;div&quot;).text(arr.join(&quot;, &quot;));

    arr = jQuery.map(arr, function(n, i){
      return (n.toUpperCase() + i);
    });
    $(&quot;p&quot;).text(arr.join(&quot;, &quot;));

    arr = jQuery.map(arr, function (a) { return a + a; });
    $(&quot;span&quot;).text(arr.join(&quot;, &quot;));

</code><css>
  div { color:blue; }
  p { color:green; margin:0; }
  span { color:red; }
  </css><html>&lt;div&gt;&lt;/div&gt;
  &lt;p&gt;&lt;/p&gt;
  &lt;span&gt;&lt;/span&gt;
  </html></example><example><desc>Maps the original array to a new one and adds 4 to each value.</desc><code>$.map( [0,1,2], function(n){
   return n + 4;
 });</code><results>[4, 5, 6]</results></example><example><desc>Maps the original array to a new one and adds 1 to each value if it is bigger then zero, otherwise it's removed.</desc><code>$.map( [0,1,2], function(n){
   return n &gt; 0 ? n + 1 : null;
 });</code><results>[2, 3]</results></example><example><desc>Maps the original array to a new one, each element is added with it's original value and the value plus one.</desc><code>$.map( [0,1,2], function(n){
   return [ n, n + 1 ];
 });</code><results>[0, 1, 1, 2, 2, 3]</results></example><example><desc>Maps the original array to a new one, each element is squared.</desc><code>$.map( [0,1,2,3], function (a) { return a * a; } );</code><results>[0, 1, 4, 9]</results></example></method>
<method cat="Utilities" name="jQuery.inArray" return="Number" timestamp="2007-10-30T05:08:17Z"><added>1.2</added><desc>Determine the index of the first parameter in the Array (-1 if not found).</desc><longdesc></longdesc><params name="value" type="Any"><desc>Value to see if it exists in the array.</desc></params><params name="array" type="Array"><desc>Array to look through for the value.</desc></params><example><desc></desc><code>

    var arr = [ 4, &quot;Pete&quot;, 8, &quot;John&quot; ];

    $(&quot;span:eq(0)&quot;).text(jQuery.inArray(&quot;John&quot;, arr));
    $(&quot;span:eq(1)&quot;).text(jQuery.inArray(4, arr));
    $(&quot;span:eq(2)&quot;).text(jQuery.inArray(&quot;David&quot;, arr));

</code><css>
  div { color:blue; }
  span { color:red; }
  </css><html>&lt;div&gt;&quot;John&quot; found at &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;4 found at &lt;span&gt;&lt;/span&gt;&lt;/div&gt;

  &lt;div&gt;&quot;David&quot; found at &lt;span&gt;&lt;/span&gt;&lt;/div&gt;</html></example></method>
<method cat="Utilities" name="jQuery.unique" return="Array" timestamp="2007-10-11T23:08:12Z"><added>1.1.3</added><desc>Remove all duplicate elements from an array of elements.</desc><longdesc></longdesc><params name="array" type="Array"><desc>The Array to translate.</desc></params><example><desc>Removes any duplicate elements from the array of divs.</desc><code>
    var divs = $(&quot;div&quot;).get();

    // add 3 elements of class dup too (they are divs)
    divs = divs.concat($(&quot;.dup&quot;).get());
    $(&quot;div:eq(1)&quot;).text(&quot;Pre-unique there are &quot; + divs.length + &quot; elements.&quot;);

    divs = jQuery.unique(divs);
    $(&quot;div:eq(2)&quot;).text(&quot;Post-unique there are &quot; + divs.length + &quot; elements.&quot;)
                  .css(&quot;color&quot;, &quot;red&quot;);

</code><css>
  div { color:blue; }
  </css><html>&lt;div&gt;There are 6 divs in this document.&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div class=&quot;dup&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;dup&quot;&gt;&lt;/div&gt;

  &lt;div class=&quot;dup&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;</html></example><example><desc>Removes any duplicate elements from the array of divs.</desc><code>$.unique(document.getElementsByTagName(&quot;div&quot;));</code><results>[&lt;div&gt;, &lt;div&gt;, ...]</results></example></method>
<method cat="Utilities" name="jQuery.isFunction" return="boolean" timestamp="2007-10-30T04:08:08Z"><added>1.2</added><desc>Determine if the parameter passed is a function.</desc><longdesc></longdesc><params name="obj" type="Object"><desc>Object to test whether or not it is a function.</desc></params><example><desc>Test a few parameter examples.</desc><code>

    function stub() {
    }
    var objs = [
          function () {},
          { x:15, y:20 },
          null,
          stub,
          &quot;function&quot;
        ];

    jQuery.each(objs, function (i) {
      var isFunc = jQuery.isFunction(objs[i]);
      $(&quot;span:eq( &quot; + i + &quot;)&quot;).text(isFunc);
    });
</code><css>
  div { color:blue; margin:2px; font-size:14px; }
  span { color:red; }
  </css><html>
  &lt;div&gt;jQuery.isFunction(objs[0]) = &lt;span&gt;&lt;/span&gt;&lt;/div&gt;

  &lt;div&gt;jQuery.isFunction(objs[1]) = &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;jQuery.isFunction(objs[2]) = &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;jQuery.isFunction(objs[3]) = &lt;span&gt;&lt;/span&gt;&lt;/div&gt;

  &lt;div&gt;jQuery.isFunction(objs[4]) = &lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  </html></example><example><desc>Finds out if the parameter is a funcion.</desc><code>$.isFunction(function(){});</code><results>true</results></example></method>
<method cat="Utilities" name="jQuery.trim" return="String" timestamp="2007-10-11T23:06:18Z"><added>1.0</added><desc>Remove the whitespace from the beginning and end of a string.</desc><longdesc>Uses a regular expression to remove whitespace from the given string.</longdesc><params name="str" type="String"><desc>The string to trim.</desc></params><example><desc>Removes the two whitespaces at the start and at the end of the string.</desc><code>

    $(&quot;button&quot;).click(function () {
      var str = &quot;     lots of spaces before and after     &quot;;
      alert(&quot;'&quot; + str + &quot;'&quot;);

      str = jQuery.trim(str);
      alert(&quot;'&quot; + str + &quot;' - no longer&quot;);
    });

</code><html>&lt;button&gt;Show Trim Example&lt;/button&gt;</html></example><example><desc>Removes the two whitespaces at the start and at the end of the string.</desc><code> $.trim(&quot;  hello, how are you?  &quot;);</code><results>&quot;hello, how are you?&quot;</results></example></method>

<method cat="Internals" name="jQuery.data" return="Number" timestamp="2007-10-30T10:55:01Z"><added>1.2</added><desc>Returns a unique ID for the element.</desc><longdesc>Typically this function will only be used internally.  It is called automatically when necessary when using the other data() functionality.</longdesc><params name="elem" type="Element"><desc>DOM element of interest.</desc></params><example><desc>Get the store id of an element.  It is assigned on the data() function call if one hasn't been assigned yet.</desc><code>
    $(document.body).click(function(e) {
      var id = jQuery.data(e.target);
      $(&quot;span&quot;).text(id);
    });

</code><css>
  div { margin:5px; background:yellow; }
  p { margin:5px; color:blue; }
  span { color:red; }
  </css><html>&lt;div&gt;A div&lt;/div&gt;
  &lt;div&gt;Another&lt;/div&gt;
  &lt;p&gt;The id of this div is &lt;span&gt;?&lt;/span&gt;&lt;/p&gt;</html></example></method>
<method cat="Internals" name="jQuery.data" return="Any" timestamp="2007-10-30T10:55:01Z"><added>1.2</added><desc>Returns value at named data store for the element.</desc><longdesc></longdesc><params name="elem" type="Element"><desc>DOM element of interest.</desc></params><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 adiv = $(&quot;div&quot;).get(0);
      var value;

      switch ($(&quot;button&quot;).index(this)) {
        case 0 :
          value = jQuery.data(adiv, &quot;blah&quot;);
          break;
        case 1 :
          jQuery.data(adiv, &quot;blah&quot;, &quot;hello&quot;);
          value = &quot;Stored!&quot;;
          break;
        case 2 :
          jQuery.data(adiv, &quot;blah&quot;, 86);
          value = &quot;Stored!&quot;;
          break;
        case 3 :
          jQuery.removeData(adiv);
          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></method>
<method cat="Internals" name="jQuery.data" return="Any" timestamp="2007-10-30T10:55:01Z"><added>1.2</added><desc>Stores the value in the named spot and also returns the value.</desc><longdesc>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.

To avoid conflicts in plugins, it is usually effective to store one object using the plugin name and put all the necessary information in that object.


&lt;code&gt;
  var obj = jQuery.data($(&quot;#target&quot;).get(0), &quot;pluginname&quot;, {});
  obj[...] = ...
&lt;/code&gt;</longdesc><params name="elem" type="Element"><desc>DOM element of interest.</desc></params><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>
    var adiv = $(&quot;div&quot;).get(0);
    jQuery.data(adiv, &quot;test&quot;, { first: 16, last: &quot;pizza!&quot; });
    $(&quot;span:first&quot;).text(jQuery.data(adiv, &quot;test&quot;).first);
    $(&quot;span:last&quot;).text(jQuery.data(adiv, &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></method>
<method cat="Internals" name="jQuery.removeData" return="" timestamp="2007-11-29T03:09:45Z"><added>1.2</added><desc>Remove the expando attribute that allows data storage on an element.</desc><longdesc>This is the complement function to jQuery.data(elem) which is called as necessary by jQuery.data(elem, name, value).</longdesc><params name="elem" type="Element"><desc>Element to delete the data store from.</desc></params><example><desc>Set a data store then remove it.</desc><code>

    var adiv = $(&quot;div&quot;).get(0);

    $(&quot;span:eq(0)&quot;).text(&quot;&quot; + jQuery.data(adiv, &quot;test1&quot;));
    jQuery.data(adiv, &quot;test1&quot;, &quot;VALUE-1&quot;);
    jQuery.data(adiv, &quot;test2&quot;, &quot;VALUE-2&quot;);
    $(&quot;span:eq(1)&quot;).text(&quot;&quot; + jQuery.data(adiv, &quot;test1&quot;));
    jQuery.removeData(adiv);
    $(&quot;span:eq(2)&quot;).text(&quot;&quot; + jQuery.data(adiv, &quot;test1&quot;));
    $(&quot;span:eq(3)&quot;).text(&quot;&quot; + jQuery.data(adiv, &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></method>
<method cat="Internals" name="jQuery.removeData" return="" timestamp="2007-11-29T03:09:45Z"><added>1.2</added><desc>Removes just this one named data store.</desc><longdesc>This is the complement function to jQuery.data(elem, name, value).</longdesc><params name="elem" type="Element"><desc>Element to delete the named data store property from.</desc></params><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>
    var adiv = $(&quot;div&quot;).get(0);

    $(&quot;span:eq(0)&quot;).text(&quot;&quot; + jQuery.data(adiv, &quot;test1&quot;));
    jQuery.data(adiv, &quot;test1&quot;, &quot;VALUE-1&quot;);
    jQuery.data(adiv, &quot;test2&quot;, &quot;VALUE-2&quot;);
    $(&quot;span:eq(1)&quot;).text(&quot;&quot; + jQuery.data(adiv, &quot;test1&quot;));
    jQuery.removeData(adiv, &quot;test1&quot;);
    $(&quot;span:eq(2)&quot;).text(&quot;&quot; + jQuery.data(adiv, &quot;test1&quot;));
    $(&quot;span:eq(3)&quot;).text(&quot;&quot; + jQuery.data(adiv, &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></method>
<method cat="Internals" name="jQuery.param" return="String" timestamp="2007-10-30T12:38:40Z"><added>1.2</added><desc>Serializes an array of form elements or an object (core of <![CDATA[<a href='Ajax/serialize'>.serialize()</a>]]> method).</desc><longdesc></longdesc><params name="obj" type="Array&lt;Elements&gt;, jQuery, Object"><desc>An Array or jQuery object is serialized by name/value pairs.  An object by key/value pairs.</desc></params><example><desc>Serialize a key/value object.</desc><code>
    var params = { width:1680, height:1050 };
    var str = jQuery.param(params);
    $(&quot;#results&quot;).text(str);

</code><css>div { color:red; }</css><html>&lt;div id=&quot;results&quot;&gt;&lt;/div&gt;</html></example></method></docs>
