[{"url":"http:\/\/api.jquery.com\/add\/","name":"add","title":".add()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"","desc":"A string representing a selector expression to find additional elements to add to the set of matched elements."}]},{"added":"1.0","params":[{"name":"elements","type":"Elements","optional":"","desc":"One or more elements to add to the set of matched elements."}]},{"added":"1.0","params":[{"name":"html","type":"HTML","optional":"","desc":"An HTML fragment to add to the set of matched elements."}]},{"added":"1.3.2","params":[{"name":"jQuery object","type":"jQuery object ","optional":"","desc":"An existing jQuery object to add to the set of matched elements."}]},{"added":"1.4","params":[{"name":"selector","type":"Selector","optional":"","desc":"A string representing a selector expression to find additional elements to add to the set of matched elements."},{"name":"context","type":"Element","optional":"","desc":"The point in the document at which the selector should begin matching; similar to the context argument of the <code>$(selector, context)<\/code> method."}]}],"desc":"Add elements to the set of matched elements.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.add()<\/code> method constructs a new jQuery object from the union of those elements and the ones passed into the method. The argument to <code>.add()<\/code> can be pretty much anything that  <code>$()<\/code> accepts, including a jQuery selector expression, references to DOM elements, or an HTML snippet.<\/p>\n<p>The updated set of elements can be used in a following (chained) method, or assigned to a variable for later use. For example:<\/p>\n<pre>\n$(\"p\").add(\"div\").addClass(\"widget\");\nvar pdiv = $(\"p\").add(\"div\");\n<\/pre>\n<p>The following will <em>not<\/em> save the added elements, because the <code>.add()<\/code> method creates a new set and leaves the original set in pdiv unchanged:<\/p>\n<pre>\nvar pdiv = $(\"p\");\npdiv.add(\"div\");  \/\/ WRONG, pdiv will not change\n<\/pre>\n<p>Consider a page with a simple list and a paragraph following it:<\/p>\n<pre>&lt;ul&gt;\n  &lt;li&gt;list item 1&lt;\/li&gt;\n  &lt;li&gt;list item 2&lt;\/li&gt;\n  &lt;li&gt;list item 3&lt;\/li&gt;\n&lt;\/ul&gt;\n&lt;p&gt;a paragraph&lt;\/p&gt;<\/pre>\n<p>We can select the list items and then the paragraph by using either a selector or a reference to the DOM element itself as the <code>.add()<\/code> method's argument:<\/p>\n<pre>$('li').add('p').css('background-color', 'red');<\/pre>\n<p>Or:<\/p>\n<pre>$('li').add(document.getElementsByTagName('p')[0])\n  .css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background behind all four elements.\nUsing an HTML snippet as the <code>.add()<\/code> method's argument (as in the third version), we can create additional elements on the fly and add those elements to the matched set of elements. Let's say, for example, that we want to alter the background of the list items along with a newly created paragraph:<\/p>\n<pre>$('li').add('&lt;p id=\"new\"&gt;new paragraph&lt;\/p&gt;')\n  .css('background-color', 'red');<\/pre>\n<p>Although the new paragraph has been created and its background color changed, it still does not appear on the page. To place it on the page, we could add one of the insertion methods to the chain.<\/p>\n<p>As of jQuery 1.4 the results from .add() will always be returned in document order (rather than a simple concatenation).<\/p>\n<p><strong>Note:<\/strong> To reverse the <code>.add()<\/code> you can use <a href=\"http:\/\/api.jquery.com\/not\"><code>.not( elements | selector )<\/code><\/a> to remove elements from the jQuery results, or <a href=\"http:\/\/api.jquery.com\/end\"><code>.end()<\/code><\/a> to return to the selection before you added.<\/p>\n","categories":["Traversing > Miscellaneous Traversing","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/addClass\/","name":"addClass","title":".addClass()","type":"method","signatures":[{"added":"1.0","params":[{"name":"className","type":"String","optional":"","desc":"One or more class names to be added to the class attribute of each matched element."}]},{"added":"1.4","params":[{"name":"function(index, currentClass)","type":"Function","optional":"","desc":"A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, <code>this<\/code> refers to the current element in the set."}]}],"desc":"Adds the specified class(es) to each of the set of matched elements.","longdesc":"<p>It's important to note that this method does not replace a class. It simply adds the class, appending it to any which may already be assigned to the elements.<\/p>\n  <p>More than one class may be added at a time, separated by a space, to the set of matched elements, like so:<\/p>\n  <pre>$(\"p\").addClass(\"myClass yourClass\");<\/pre>\n  <p>This method is often used with <code>.removeClass()<\/code> to switch elements' classes from one to another, like so:<\/p>\n  <pre>$(\"p\").removeClass(\"myClass noClass\").addClass(\"yourClass\");<\/pre>\n  <p>Here, the <code>myClass<\/code> and <code>noClass<\/code> classes are removed from all paragraphs, while <code>yourClass<\/code> is added.<\/p>\n<p>As of jQuery 1.4, the <code>.addClass()<\/code> method's argument can receive a function.<\/p>\n<pre>$(\"ul li:last\").addClass(function(index) {\n  return \"item-\" + index;\n});<\/pre>\n<p>Given an unordered list with five <code>&lt;li&gt;<\/code> elements, this example adds the class \"item-4\" to the last <code>&lt;li&gt;<\/code>.<\/p>\n\n","categories":["Attributes","Manipulation > Class Attribute","CSS","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/after\/","name":"after","title":".after()","type":"method","signatures":[{"added":"1.0","params":[{"name":"content","type":"String, Element, jQuery","optional":"","desc":"HTML string, DOM element, or jQuery object to insert after each element in the set of matched elements."},{"name":"content","type":"String, Element, Array, jQuery","optional":"optional","desc":"One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements."}]},{"added":"1.4","params":[{"name":"function(index)","type":"Function","optional":"","desc":"A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, <code>this<\/code> refers to the current element in the set."}]}],"desc":"Insert content, specified by the parameter, after each element in the set of matched elements.","longdesc":"<p>The <code>.after()<\/code> and <code><a href=\"\/insertAfter\">.insertAfter()<\/a><\/code> methods perform the same task. The major difference is in the syntax\u2014specifically, in the placement of the content and target. With<code> .after()<\/code>, the selector expression preceding the method is the container after which the content is inserted. With <code>.insertAfter()<\/code>, on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted after the target container.<\/p>\n\n<p>Using the following HTML:<\/p>\n<pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\n<p>Content can be created and then inserted after several elements at once:<\/p>\n\n<pre>$('.inner').after('&lt;p&gt;Test&lt;\/p&gt;');<\/pre>\n\n<p>Each inner <code>&lt;div&gt;<\/code> element gets this new content:<\/p>\n\n<pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;p&gt;Test&lt;\/p&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n  &lt;p&gt;Test&lt;\/p&gt;\n&lt;\/div&gt;<\/pre>\n\n<p>An element in the DOM can also be selected and inserted after another element:<\/p>\n\n<pre>$('.container').after($('h2'));<\/pre>\n\n<p>If an element selected this way is inserted elsewhere, it will be moved rather than cloned:<\/p>\n\n<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;\n&lt;h2&gt;Greetings&lt;\/h2&gt;<\/pre>\n<p>If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first.<\/p>\n<h4 id=\"disconnected-dom-nodes\">Inserting Disconnected DOM nodes<\/h4>\n<p>As of jQuery 1.4, <code>.before()<\/code> and <code>.after()<\/code> will also work on disconnected DOM nodes. For example, given the following code:<\/p>\n<pre>$('&lt;div\/&gt;').after('&lt;p&gt;&lt;\/p&gt;');<\/pre>\n<p>The result is a jQuery set containing a div and a paragraph, in that order. That set can be further manipulated, even before it is inserted in the document.<\/p>\n<pre>$('&lt;div\/&gt;').after('&lt;p&gt;&lt;\/p&gt;').addClass('foo')\n  .filter('p').attr('id', 'bar').html('hello')\n.end()\n.appendTo('body');<\/pre>\n<p>This results in the following elements inserted just before the closing <code>&lt;\/body&gt;<\/code> tag:<\/p>\n<pre>\n&lt;div class=\"foo\"&gt;&lt;\/div&gt;\n&lt;p class=\"foo\" id=\"bar\"&gt;hello&lt;\/p&gt;\n<\/pre>\n<h4 id=\"passing-a-function\">Passing a Function<\/h4>\n<p>As of jQuery 1.4, <code>.after()<\/code> supports passing a function that returns the elements to insert.<\/p>\n<pre>$('p').after(function() {\n  return '&lt;div&gt;' + this.className + '&lt;\/div&gt;';\n});<\/pre>\n<p>This example inserts a <code>&lt;div&gt;<\/code> after each paragraph, with each new <code>&lt;div&gt;<\/code> containing the class name(s) of its preceding paragraph.<\/p>\n    <h4 id=\"additional-arguments\">Additional Arguments<\/h4>\n    <p>Similar to other content-adding methods such as <code><a href=\"http:\/\/api.jquery.com\/prepend\/\">.prepend()<\/a><\/code> and <code><a href=\"http:\/\/api.jquery.com\/before\/\">.before()<\/a><\/code>, <code>.after()<\/code> also supports passing in multiple arguments as input. Supported input includes DOM elements, jQuery objects, HTML strings, and arrays of DOM elements.<\/p> \n    <p>For example, the following will insert two new <code>&lt;div&gt;<\/code>s and an existing <code>&lt;div&gt;<\/code> after the first paragraph:<\/p>\n<pre>var $newdiv1 = $('&lt;div id=\"object1\"\/&gt;'),\n    newdiv2 = document.createElement('div'),\n    existingdiv1 = document.getElementById('foo');\n\n$('p').first().after($newdiv1, [newdiv2, existingdiv1]);\n<\/pre>\n<p>Since <code>.after()<\/code> can accept any number of additional arguments, the same result can be achieved by passing in the three <code>&lt;div&gt;<\/code>s as three separate arguments, like so: <code>$('p').first().after($newdiv1, newdiv2, existingdiv1)<\/code>. The type and number of arguments will largely depend on the elements that are collected in the code.<\/p>\n\n","categories":["Manipulation > DOM Insertion"," Outside","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/ajaxComplete\/","name":"ajaxComplete","title":".ajaxComplete()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(event, XMLHttpRequest, ajaxOptions)","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"Register a handler to be called when Ajax requests complete. This is an <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Event<\/a>.","longdesc":"<p>Whenever an Ajax request completes, jQuery triggers the <code>ajaxComplete<\/code> event. Any and all handlers that have been registered with the <code>.ajaxComplete()<\/code> method are executed at this time.<\/p>\n\t\t\t\t<p>To observe this method in action, we can set up a basic Ajax load request:<\/p>\n\t\t\t\t<pre>&lt;div class=\"trigger\"&gt;Trigger&lt;\/div&gt;\n&lt;div class=\"result\"&gt;&lt;\/div&gt;\n&lt;div class=\"log\"&gt;&lt;\/div&gt;\n<\/pre>\n\t\t\t\t<p>We can attach our event handler to any element:<\/p>\n\t\t\t\t<pre>$('.log').ajaxComplete(function() {\n  $(this).text('Triggered ajaxComplete handler.');\n});\n<\/pre>\n\t\t\t\t<p>Now, we can make an Ajax request using any jQuery method:<\/p>\n\t\t\t\t<pre>$('.trigger').click(function() {\n  $('.result').load('ajax\/test.html');\n});<\/pre>\n\t\t\t\t<p>When the user clicks the element with class <code>trigger<\/code> and the Ajax request completes, the log message is displayed.<\/p>\n\n\t\t\t\t<p><strong>Note:<\/strong> Because <code>.ajaxComplete()<\/code> is implemented as a method of jQuery object instances, we can use the <code>this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n\n\t\t\t\t<p>All <code>ajaxComplete<\/code> handlers are invoked, regardless of what Ajax request was completed. If we must differentiate between the requests, we can use the parameters passed to the handler. Each time an <code>ajaxComplete<\/code> handler is executed, it is passed the event object, the <code>XMLHttpRequest<\/code> object, and the settings object that was used in the creation of the request. For example, we can restrict our callback to only handling events dealing with a particular URL:<\/p>\n\n<p><strong>Note:<\/strong> You can get the returned ajax contents by looking at <code>xhr.responseXML<\/code> or <code>xhr.responseHTML<\/code> for xml and html respectively.<\/p>\n\n\t\t\t\t<pre>$('.log').ajaxComplete(function(e, xhr, settings) {\n  if (settings.url == 'ajax\/test.html') {\n    $(this).text('Triggered ajaxComplete handler. The result is ' +\n                     xhr.responseHTML);\n  }\n});<\/pre>","categories":["Ajax > Global Ajax Event Handlers","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/ajaxError\/","name":"ajaxError","title":".ajaxError()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(event, jqXHR, ajaxSettings, thrownError)","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"Register a handler to be called when Ajax requests complete with an error. This is an <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Event<\/a>.","longdesc":"<p>Whenever an Ajax request completes with an error, jQuery triggers the <code>ajaxError<\/code> event. Any and all handlers that have been registered with the <code>.ajaxError()<\/code> method are executed at this time.<\/p>\n    <p>To observe this method in action, set up a basic Ajax load request.<\/p>\n<pre>&lt;button class=\"trigger\"&gt;Trigger&lt;\/button&gt;\n&lt;div class=\"result\"&gt;&lt;\/div&gt;\n&lt;div class=\"log\"&gt;&lt;\/div&gt;<\/pre>\n    <p>Attach the event handler to any element:<\/p>\n<pre>$(\"div.log\").ajaxError(function() {\n  $(this).text( \"Triggered ajaxError handler.\" );\n});<\/pre>\n    <p>Now, make an Ajax request using any jQuery method:<\/p>\n<pre>$(\"button.trigger\").click(function() {\n  $(\"div.result\").load( \"ajax\/missing.html\" );\n});<\/pre>\n    <p>When the user clicks the button and the Ajax request fails, because the requested file is missing, the log message is displayed.<\/p>\n\n    <p><strong>Note:<\/strong> Because <code>.ajaxError()<\/code> is implemented as a method of jQuery object instances, you can use the <code>this<\/code> keyword within the callback function to refer to the selected elements.<\/p>\n\n    <p>All <code>ajaxError<\/code> handlers are invoked, regardless of what Ajax request was completed. To differentiate between the requests, you can use the parameters passed to the handler. Each time an <code>ajaxError<\/code> handler is executed, it is passed the event object, the <code>jqXHR<\/code> object (prior to jQuery 1.5, the <code><abbr title=\"XMLHttpRequest\">XHR<\/abbr><\/code> object), and the settings object that was used in the creation of the request. If the request failed because JavaScript raised an exception, the exception object is passed to the handler as a fourth parameter. For example, to restrict the error callback to only handling events dealing with a particular URL:<\/p>\n<pre>$( \"div.log\" ).ajaxError(function(e, jqxhr, settings, exception) {\n  if ( settings.url == \"ajax\/missing.html\" ) {\n    $(this).text( \"Triggered ajaxError handler.\" );\n  }\n});<\/pre>\n  ","categories":["Ajax > Global Ajax Event Handlers","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/ajaxSend\/","name":"ajaxSend","title":".ajaxSend()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(event, jqXHR, ajaxOptions)","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"Attach a function to be executed before an Ajax request is sent. This is an <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Event<\/a>.","longdesc":"\n    <p>Whenever an Ajax request is about to be sent, jQuery triggers the <code>ajaxSend<\/code> event. Any and all handlers that have been registered with the <code>.ajaxSend()<\/code> method are executed at this time.<\/p>\n    <p>To observe this method in action, we can set up a basic Ajax load request:<\/p>\n<pre>&lt;div class=\"trigger\"&gt;Trigger&lt;\/div&gt;\n&lt;div class=\"result\"&gt;&lt;\/div&gt;\n&lt;div class=\"log\"&gt;&lt;\/div&gt;<\/pre>\n    <p>We can attach our event handler to any element:<\/p>\n<pre>$('.log').ajaxSend(function() {\n  $(this).text('Triggered ajaxSend handler.');\n});<\/pre>\n    <p>Now, we can make an Ajax request using any jQuery method:<\/p>\n    <pre>$('.trigger').click(function() {\n  $('.result').load('ajax\/test.html');\n});<\/pre>\n    <p>When the user clicks the element with class <code>trigger<\/code> and the Ajax request is about to begin, the log message is displayed.<\/p>\n\n    <p><strong>Note:<\/strong> Because <code>.ajaxSend()<\/code> is implemented as a method of jQuery instances, we can use the <code>this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n\n    <p>All <code>ajaxSend<\/code> handlers are invoked, regardless of what Ajax request is to be sent. If we must differentiate between the requests, we can use the parameters passed to the handler. Each time an <code>ajaxSend<\/code> handler is executed, it is passed the event object, the <code>jqXHR<\/code> object (in version 1.4, <code>XMLHttpRequest<\/code>object), and the <a href=\"http:\/\/api.jquery.com\/jQuery.ajax\/\">settings object<\/a> that was used in the creation of the Ajax request. For example, we can restrict our callback to only handling events dealing with a particular URL:<\/p>\n    <pre>$('.log').ajaxSend(function(e, jqxhr, settings) {\n  if (settings.url == 'ajax\/test.html') {\n    $(this).text('Triggered ajaxSend handler.');\n  }\n});<\/pre>\n    ","categories":["Ajax > Global Ajax Event Handlers","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/ajaxStart\/","name":"ajaxStart","title":".ajaxStart()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler()","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"Register a handler to be called when the first Ajax request begins. This is an <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Event<\/a>.","longdesc":"<p>Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the <code>ajaxStart<\/code> event. Any and all handlers that have been registered with the <code>.ajaxStart()<\/code> method are executed at this time.<\/p>\n\t\t\t\t<p>To observe this method in action, we can set up a basic Ajax load request:<\/p>\n\t\t\t\t<pre>&lt;div class=\"trigger\"&gt;Trigger&lt;\/div&gt;\n&lt;div class=\"result\"&gt;&lt;\/div&gt;\n&lt;div class=\"log\"&gt;&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>We can attach our event handler to any element:<\/p>\n\t\t\t\t<pre>$('.log').ajaxStart(function() {\n  $(this).text('Triggered ajaxStart handler.');\n});<\/pre>\n\t\t\t\t<p>Now, we can make an Ajax request using any jQuery method:<\/p>\n\t\t\t\t<pre>$('.trigger').click(function() {\n  $('.result').load('ajax\/test.html');\n});<\/pre>\n\t\t\t\t<p>When the user clicks the element with class <code>trigger<\/code> and the Ajax request is sent, the log message is displayed.<\/p>\n\n\t\t\t\t<p><strong>Note:<\/strong> Because <code>.ajaxStart()<\/code> is implemented as a method of jQuery object instances, we can use the <code>this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n","categories":["Ajax > Global Ajax Event Handlers","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/ajaxStop\/","name":"ajaxStop","title":".ajaxStop()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler()","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"Register a handler to be called when all Ajax requests have completed. This is an <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Event<\/a>.","longdesc":"\n    <p>Whenever an Ajax request completes, jQuery checks whether there are any other outstanding Ajax requests. If none remain, jQuery triggers the <code>ajaxStop<\/code> event. Any and all handlers that have been registered with the <code>.ajaxStop()<\/code> method are executed at this time. The <code>ajaxStop<\/code> event is also triggered if the last outstanding Ajax request is cancelled by returning false within the <code>beforeSend<\/code> callback function. <\/p>\n    <p>To observe this method in action, we can set up a basic Ajax load request:<\/p>\n    <pre>&lt;div class=\"trigger\"&gt;Trigger&lt;\/div&gt;\n&lt;div class=\"result\"&gt;&lt;\/div&gt;\n&lt;div class=\"log\"&gt;&lt;\/div&gt;<\/pre>\n    <p>We can attach our event handler to any element:<\/p>\n    <pre>$('.log').ajaxStop(function() {\n  $(this).text('Triggered ajaxStop handler.');\n});<\/pre>\n    <p>Now, we can make an Ajax request using any jQuery method:<\/p>\n    <pre>$('.trigger').click(function() {\n  $('.result').load('ajax\/test.html');\n});<\/pre>\n    <p>When the user clicks the element with class <code>trigger<\/code> and the Ajax request completes, the log message is displayed.<\/p>\n  \t<p>Because <code>.ajaxStop()<\/code> is implemented as a method of jQuery object instances, we can use the <code>this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n  ","categories":["Ajax > Global Ajax Event Handlers","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/ajaxSuccess\/","name":"ajaxSuccess","title":".ajaxSuccess()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(event, XMLHttpRequest, ajaxOptions)","type":"Function","optional":"","desc":"The function to be invoked."}]}],"desc":"Attach a function to be executed whenever an Ajax request completes successfully. This is an <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Event<\/a>.","longdesc":"\n    <p>Whenever an Ajax request completes successfully, jQuery triggers the <code>ajaxSuccess<\/code> event. Any and all handlers that have been registered with the <code>.ajaxSuccess()<\/code> method are executed at this time.<\/p>\n    <p>To observe this method in action, we can set up a basic Ajax load request:<\/p>\n\t\t<pre>&lt;div class=\"trigger\"&gt;Trigger&lt;\/div&gt;\n&lt;div class=\"result\"&gt;&lt;\/div&gt;\n&lt;div class=\"log\"&gt;&lt;\/div&gt;<\/pre>\n    <p>We can attach our event handler to any element:<\/p>\n    <pre>$('.log').ajaxSuccess(function() {\n  $(this).text('Triggered ajaxSuccess handler.');\n});<\/pre>\n    <p>Now, we can make an Ajax request using any jQuery method:<\/p>\n    <pre>$('.trigger').click(function() {\n  $('.result').load('ajax\/test.html');\n});<\/pre>\n\t\t<p>When the user clicks the element with class <code>trigger<\/code> and the Ajax request completes successfully, the log message is displayed.<\/p>\n\n\n    <p><strong>Note:<\/strong> Because <code>.ajaxSuccess()<\/code> is implemented as a method of jQuery object instances, we can use the <code>this<\/code> keyword as we do here to refer to the selected elements within the callback function.<\/p>\n\n\t\t<p>All <code>ajaxSuccess<\/code> handlers are invoked, regardless of what Ajax request was completed. If we must differentiate between the requests, we can use the parameters passed to the handler. Each time an <code>ajaxSuccess<\/code> handler is executed, it is passed the event object, the <code>XMLHttpRequest<\/code> object, and the settings object that was used in the creation of the request. For example, we can restrict our callback to only handling events dealing with a particular URL:<\/p>\n\n<p><strong>Note:<\/strong> You can get the returned ajax contents by looking at <code>xhr.responseXML<\/code> or <code>xhr.responseText<\/code> for xml and html respectively.<\/p>\n\n\t  <pre>$('.log').ajaxSuccess(function(e, xhr, settings) {\n  if (settings.url == 'ajax\/test.html') {\n    $(this).text('Triggered ajaxSuccess handler. The ajax response was:' \n                     + xhr.responseText );\n  }\n});<\/pre>\n  ","categories":["Ajax > Global Ajax Event Handlers","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/all-selector\/","name":"all","title":"All Selector (\"*\")","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements.","longdesc":"<p>Caution: The all, or universal, selector is extremely slow, except when used by itself.<\/p> ","categories":["Selectors > Basic","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/andSelf\/","name":"andSelf","title":".andSelf()","type":"method","signatures":[{"added":"1.2"}],"desc":"Add the previous set of elements on the stack to the current set.","longdesc":"<p>As described in the discussion for <code><a href=\"http:\/\/api.jquery.com\/end\/\">.end()<\/a><\/code>, jQuery objects maintain an internal stack that keeps track of changes to the matched set of elements. When one of the DOM traversal methods is called, the new set of elements is pushed onto the stack. If the previous set of elements is desired as well, <code>.andSelf()<\/code> can help.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n&lt;ul&gt;\n   &lt;li&gt;list item 1&lt;\/li&gt;\n   &lt;li&gt;list item 2&lt;\/li&gt;\n   &lt;li class=\"third-item\"&gt;list item 3&lt;\/li&gt;\n   &lt;li&gt;list item 4&lt;\/li&gt;\n   &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>The result of the following code is a red background behind items 3, 4 and 5:<\/p>\n<pre>$('li.third-item').nextAll().andSelf()\n  .css('background-color', 'red');\n<\/pre>\n<p>First, the initial selector locates item 3, initializing the stack with the set containing just this item. The call to <code>.nextAll()<\/code> then pushes the set of items 4 and 5 onto the stack. Finally, the <code>.andSelf()<\/code> invocation merges these two sets together, creating a jQuery object that points to all three items in document order: <code>{[&lt;li.third-item&gt;,&lt;li&gt;,&lt;li&gt; ]}<\/code>.<\/p>","categories":["Traversing > Miscellaneous Traversing","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/animate\/","name":"animate","title":".animate()","type":"method","signatures":[{"added":"1.0","params":[{"name":"properties","type":"Map","optional":"","desc":"A map of CSS properties that the animation will move toward."},{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"complete","type":"Function","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.0","params":[{"name":"properties","type":"Map","optional":"","desc":"A map of CSS properties that the animation will move toward."},{"name":"options","type":"Map","optional":"","desc":"A map of additional options to pass to the method. Supported keys:\n        <ul>\n        <li><code>duration<\/code>: A string or number determining how long the animation will run.<\/li>\n        <li><code>easing<\/code>: A string indicating which easing function to use for the transition.<\/li>\n        <li><code>complete<\/code>: A function to call once the animation is complete.<\/li>\n        <li><code>step<\/code>: A function to be called after each step of the animation.<\/li>\n        <li><code>queue<\/code>: A Boolean indicating whether to place the animation in the effects queue. If <code>false<\/code>, the animation will begin immediately. <strong>As of jQuery 1.7<\/strong>, the <code>queue<\/code> option can also accept a string, in which case the animation is added to the queue represented by that string.<\/li>\n        <li><code>specialEasing<\/code>: A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions (added 1.4).<\/li>\n        <\/ul>\n        "}]}],"desc":"Perform a custom animation of a set of CSS properties.","longdesc":"\n  <p>The <code>.animate()<\/code> method allows us to create animation effects on any numeric CSS property. The only required parameter is a map of CSS properties. This map is similar to the one that can be sent to the <code>.css()<\/code> method, except that the range of properties is more restrictive.<\/p>\n\n<h4 id=\"animation-properties\">Animation Properties and Values<\/h4>\n<p>All animated properties should be animated to a <em>single numeric value<\/em>, except as noted below; most properties that are non-numeric cannot be animated using basic jQuery functionality (For example, <code>width<\/code>, <code>height<\/code>, or <code>left<\/code> can be animated but <code>background-color<\/code> cannot be, unless the <a href=\"https:\/\/github.com\/jquery\/jquery-color\">jQuery.Color()<\/a> plugin is used). Property values are treated as a number of pixels unless otherwise specified. The units <code>em<\/code> and <code>%<\/code> can be specified where applicable.<\/p>\n<p>In addition to style properties, some non-style properties such as <code>scrollTop<\/code> and <code>scrollLeft<\/code>, as well as custom properties, can be animated.<\/p>\n<p>Shorthand CSS properties (e.g. font, background, border) are not fully supported. For example, if you want to animate the rendered border width, at least a border style and border width other than \"auto\" must be set in advance. Or, if you want to animate font size, you would use <code>fontSize<\/code> or the CSS equivalent <code>'font-size'<\/code> rather than simply <code>'font'<\/code>. <\/p>\n<p>In addition to numeric values, each property can take the strings <code>'show'<\/code>, <code>'hide'<\/code>, and <code>'toggle'<\/code>. These shortcuts allow for custom hiding and showing animations that take into account the display type of the element.<\/p>\n<p>Animated properties can also be relative. If a value is supplied with a leading <code>+=<\/code> or <code>-=<\/code> sequence of characters, then the target value is computed by adding or subtracting the given number from the current value of the property.<\/p>\n<blockquote><p><strong>Note:<\/strong> Unlike shorthand animation methods such as <code>.slideDown()<\/code> and <code>.fadeIn()<\/code>, the <code>.animate()<\/code> method does <em>not<\/em> make hidden elements visible as part of the effect. For example, given <code>$('someElement').hide().animate({height:'20px'}, 500)<\/code>, the animation will run, but <em>the element will remain hidden<\/em>.<\/p><\/blockquote>\n<h4 id=\"duration\">Duration<\/h4>\n<p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The default duration is <code>400<\/code> milliseconds. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively.<\/p>\n\n<h4 id=\"complete\">Complete Function<\/h4>\n<p>If supplied, the <code>complete<\/code> callback function is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n\n<h4 id=\"basic-usage\">Basic Usage<\/h4>\n<p>To animate any element, such as a simple image:<\/p>\n<pre>&lt;div id=\"clickme\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\"\n  style=\"position: relative; left: 10px;\" \/&gt;<\/pre>\n<p>To animate the opacity, left offset, and height of the image simultaneously:<\/p>\n<pre>$('#clickme').click(function() {\n  $('#book').animate({\n    opacity: 0.25,\n    left: '+=50',\n    height: 'toggle'\n  }, 5000, function() {\n    \/\/ Animation complete.\n  });\n});\n<\/pre>\n<p class=\"image\">\n  <img src=\"\/images\/animate-1.jpg\" alt=\"\"\/>\n<\/p>\n<p>Note that the target value of the <code>height<\/code> property is <code>'toggle'<\/code>. Since the image was visible before, the animation shrinks the height to 0 to hide it. A second click then reverses this transition:\n<\/p>\n<p class=\"image\">\n<img src=\"\/images\/animate-2.jpg\" alt=\"\"\/>\n<\/p>\n\n<p>The <code>opacity<\/code> of the image is already at its target value, so this property is not animated by the second click. Since the target value for <code>left<\/code> is a relative value, the image moves even farther to the right during this second animation.<\/p>\n<p>Directional properties (<code>top<\/code>, <code>right<\/code>, <code>bottom<\/code>, <code>left<\/code>) have no discernible effect on elements if their  <code>position<\/code> style property is <code>static<\/code>, which it is by default.<\/p>\n<blockquote><p><strong>Note: <\/strong>The <a href=\"http:\/\/jqueryui.com\">jQuery UI<\/a> project extends the <code>.animate()<\/code> method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes.<\/p><\/blockquote>\n<blockquote><p><strong>Note:<\/strong> if attempting to animate an element with a height or width of 0px, where contents of the element are visible due to overflow, jQuery may clip this overflow during animation. By fixing the dimensions of the original element being hidden however, it is possible to ensure that the animation runs smoothly. A <a href=\"http:\/\/www.google.com\/search?q=clearfix\">clearfix<\/a> can be used to automatically fix the dimensions of your main element without the need to set this manually.<\/p><\/blockquote>\n\n<h4 id=\"step\">Step Function<\/h4>\n<p>The second version of <code>.animate()<\/code> provides a <code>step<\/code> option \u2014 a callback function that is fired at each step of the animation. This function is useful for enabling custom animation types or altering the animation as it is occurring. It accepts two arguments (<code>now<\/code> and <code>fx<\/code>), and <code>this<\/code> is set to the DOM element being animated.\n<\/p>\n<ul>\n  <li><code>now<\/code>: the numeric value of the property being animated at each step<\/li>\n  <li><code>fx<\/code>: a reference to the <code>jQuery.fx<\/code> prototype object, which contains a number of properties such as <code>elem<\/code> for the animated element, <code>start<\/code> and <code>end<\/code> for the first and last value of the animated property, respectively, and <code>prop<\/code> for the property being animated.<\/li>\n<\/ul>\n<p>Note that the <code>step<\/code> function is called for each animated property on each animated element. For example, given two list items, the <code>step<\/code> function fires four times at each step of the animation:  <\/p>\n<pre>$('li').animate({\n  opacity: .5,\n  height: '50%'\n},\n{\n  step: function(now, fx) {\n    var data = fx.elem.id + ' ' + fx.prop + ': ' + now;\n    $('body').append('&lt;div&gt;' + data + '&lt;\/div&gt;');\n  }\n});<\/pre>\n\n\n<h4 id=\"easing\">Easing<\/h4>\n<p>The remaining parameter of <code>.animate()<\/code> is a string naming an easing function to use. An easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing<\/code>, and one that progresses at a constant pace, called <code>linear<\/code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http:\/\/jqueryui.com\/\">jQuery UI suite<\/a>.<\/p>\n\n<h4 id=\"per-property-easing\">Per-property Easing<\/h4>\n<p>As of jQuery version 1.4, you can set per-property easing functions within a single <code>.animate()<\/code> call. In the first version of <code>.animate()<\/code>, each property can take an array as its value: The first member of the array is the CSS property and the second member is an easing function.  If a per-property easing function is not defined for a particular property, it uses the value of the <code>.animate()<\/code> method's optional easing argument. If the easing argument is not defined, the default <code>swing<\/code> function is used.<\/p>\n<p>For example, to simultaneously animate the width and height with the <code>swing<\/code> easing function and the opacity with the <code>linear<\/code> easing function:<\/p>\n<pre>$('#clickme').click(function() {\n  $('#book').animate({\n    width: ['toggle', 'swing'],\n    height: ['toggle', 'swing'],\n    opacity: 'toggle'\n  }, 5000, 'linear', function() {\n      $(this).after('&lt;div&gt;Animation complete.&lt;\/div&gt;');\n  });\n});<\/pre>\n<p>In the second version of <code>.animate()<\/code>, the options map can include the <code>specialEasing<\/code> property, which is itself a map of CSS properties and their corresponding easing functions.  For example, to simultaneously animate the width using the <code>linear<\/code> easing function and the height using the <code>easeOutBounce<\/code> easing function:<\/p>\n<pre>$('#clickme').click(function() {\n  $('#book').animate({\n    width: 'toggle',\n    height: 'toggle'\n  }, {\n    duration: 5000,\n    specialEasing: {\n      width: 'linear',\n      height: 'easeOutBounce'\n    },\n    complete: function() {\n      $(this).after('&lt;div&gt;Animation complete.&lt;\/div&gt;');\n    }\n  });\n});<\/pre>\n<p>As previously noted, a plugin is required for the <code>easeOutBounce<\/code> function.<\/p>\n\n","categories":["Effects > Custom","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/animated-selector\/","name":"animated","title":":animated Selector","type":"selector","signatures":[{"added":"1.2"}],"desc":"Select all elements that are in the progress of an animation at the time the selector is run.","longdesc":"<longdesc\/>","categories":["Selectors > Basic Filter","Selectors > jQuery Extensions","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/append\/","name":"append","title":".append()","type":"method","signatures":[{"added":"1.0","params":[{"name":"content","type":"String, Element, jQuery","optional":"","desc":"DOM element, HTML string, or jQuery object to insert at the end of each element in the set of matched elements."},{"name":"content","type":"String, Element, Array, jQuery","optional":"optional","desc":"One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements."}]},{"added":"1.4","params":[{"name":"function(index, html)","type":"Function","optional":"","desc":"A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, <code>this<\/code> refers to the current element in the set.\n"}]}],"desc":"Insert content, specified by the parameter, to the end of each element in the set of matched elements.","longdesc":"<p>The <code>.append()<\/code> method inserts the  specified content as the last child of each element in the jQuery collection (To insert it as the <em>first<\/em> child, use <a href=\"http:\/\/api.jquery.com\/prepend\/\"><code>.prepend()<\/code><\/a>). <\/p>\n    <p>The <code>.append()<\/code> and <code><a href=\"\/appendTo\">.appendTo()<\/a><\/code> methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With<code> .append()<\/code>, the selector expression preceding the method is the container into which the content is inserted. With <code>.appendTo()<\/code>, on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted into the target container.<\/p>\n    <p>Consider the following HTML:<\/p>\n    <pre>&lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;\n<\/pre>\n<p>You can create content and insert it into several elements at once:<\/p>\n<pre>$('.inner').append('&lt;p&gt;Test&lt;\/p&gt;');\n<\/pre>\n<p>Each inner <code>&lt;div&gt;<\/code> element gets this new content:<\/p>\n<pre>&lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;\n    Hello\n    &lt;p&gt;Test&lt;\/p&gt;\n  &lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;\n    Goodbye\n    &lt;p&gt;Test&lt;\/p&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;\n<\/pre>\n<p>You can also select an element on the page and insert it into another:<\/p>\n<pre>$('.container').append($('h2'));\n<\/pre>\n<p>If an element selected this way is inserted elsewhere, it will be moved into the target (not cloned):<\/p>\n<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;\/div&gt;\n<\/pre>\n<p>If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first.<\/p>\n\n    <h4 id=\"additional-arguments\">Additional Arguments<\/h4>\n    <p>Similar to other content-adding methods such as <code><a href=\"http:\/\/api.jquery.com\/prepend\/\">.prepend()<\/a><\/code> and <code><a href=\"http:\/\/api.jquery.com\/before\/\">.before()<\/a><\/code>, <code>.append()<\/code> also supports passing in multiple arguments as input. Supported input includes DOM elements, jQuery objects, HTML strings, and arrays of DOM elements.<\/p> \n    <p>For example, the following will insert two new <code>&lt;div&gt;<\/code>s and an existing <code>&lt;div&gt;<\/code> as the last three child nodes of the body:<\/p>\n<pre>var $newdiv1 = $('&lt;div id=\"object1\"\/&gt;'),\n    newdiv2 = document.createElement('div'),\n    existingdiv1 = document.getElementById('foo');\n\n$('body').append($newdiv1, [newdiv2, existingdiv1]);\n<\/pre>\n<p>Since <code>.append()<\/code> can accept any number of additional arguments, the same result can be achieved by passing in the three <code>&lt;div&gt;<\/code>s as three separate arguments, like so: <code>$('body').append($newdiv1, newdiv2, existingdiv1)<\/code>. The type and number of arguments will largely depend on how you collect the elements in your code.<\/p>\n","categories":["Manipulation > DOM Insertion"," Inside","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/appendTo\/","name":"appendTo","title":".appendTo()","type":"method","signatures":[{"added":"1.0","params":[{"name":"target","type":"Selector, Element, jQuery","optional":"","desc":"A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter."}]}],"desc":"Insert every element in the set of matched elements to the end of the target.","longdesc":"<p>The <code><a href=\"\/append\">.append()<\/a><\/code> and <code>.appendTo()<\/code> methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With<code> .append()<\/code>, the selector expression preceding the method is the container into which the content is inserted. With <code>.appendTo()<\/code>, on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted into the target container.<\/p>\n\t\t\t\t<p>Consider the following HTML:<\/p>\n\t\t\t\t<pre>&lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;\n<\/pre>\n\t\t\t\t<p>We can create content and insert it into several elements at once:<\/p>\n\t\t\t\t<pre>$('&lt;p&gt;Test&lt;\/p&gt;').appendTo('.inner');\n<\/pre>\n\t\t\t\t<p>Each inner <code>&lt;div&gt;<\/code> element gets this new content:<\/p>\n\t\t\t\t<pre>&lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;\n    Hello\n    &lt;p&gt;Test&lt;\/p&gt;\n  &lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;\n    Goodbye\n    &lt;p&gt;Test&lt;\/p&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;\n<\/pre>\n\t\t\t\t<p>We can also select an element on the page and insert it into another:<\/p>\n\t\t\t\t<pre>$('h2').appendTo($('.container'));\n<\/pre>\n\t\t\t\t<p>If an element selected this way is inserted elsewhere, it will be moved into the target (not cloned):<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;\/div&gt;\n<\/pre>\n\t\t\t\t<p>If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first, and that new set (the original element plus clones) is returned.<\/p>","categories":["Manipulation > DOM Insertion"," Inside","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/attr\/","name":"attr","title":".attr()","type":"method","signatures":[{"added":"1.0","params":[{"name":"attributeName","type":"String","optional":"","desc":"The name of the attribute to get."}]}],"desc":"Get the value of an attribute for the first element in the set of matched elements.","longdesc":"<p>The <code>.attr()<\/code> method gets the attribute value for only the <em>first<\/em> element in the matched set. To get the value for each element individually, use a looping construct such as jQuery's <code>.each()<\/code> or <code>.map()<\/code> method.<\/p>\n  \t<p><strong>As of jQuery 1.6<\/strong>, the <code>.attr()<\/code> method returns <code>undefined<\/code> for attributes that have not been set. In addition, <code>.attr()<\/code> should not be used on plain objects, arrays, the window, or the document. To retrieve and change DOM properties, use the <a href=\"http:\/\/api.jquery.com\/prop\/\">.prop()<\/a> method.<\/p>\n    <p>Using jQuery's <code>.attr()<\/code> method to get the value of an element's attribute has two main benefits:<\/p>\n    <ol>\n      <li><strong>Convenience<\/strong>: It can be called directly on a jQuery object and chained to other jQuery methods.<\/li>\n      <li><strong>Cross-browser consistency<\/strong>: The values of some attributes are reported inconsistently across browsers, and even across versions of a single browser. The <code>.attr()<\/code> method reduces such inconsistencies.<\/li>\n    <\/ol>\n<blockquote><p><strong>Note:<\/strong> Attribute values are strings with the exception of a few attributes such as value and tabindex.<\/p><\/blockquote>\n  ","categories":["Attributes","Manipulation > General Attributes","Version > Version 1.0","Version > Version 1.1","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/attr\/","name":"attr","title":".attr()","type":"method","signatures":[{"added":"1.0","params":[{"name":"attributeName","type":"String","optional":"","desc":"The name of the attribute to set."},{"name":"value","type":"String,Number","optional":"","desc":"A value to set for the attribute."}]},{"added":"1.0","params":[{"name":"map","type":"Map","optional":"","desc":"A map of attribute-value pairs to set."}]},{"added":"1.1","params":[{"name":"attributeName","type":"String","optional":"","desc":"The name of the attribute to set."},{"name":"function(index, attr)","type":"Function","optional":"","desc":"A function returning the value to set. <code>this<\/code> is the current element. Receives the index position of the element in the set and the old attribute value as arguments."}]}],"desc":"Set one or more attributes for the set of matched elements.","longdesc":"<p>The <code>.attr()<\/code> method is a convenient way to set the value of attributes\u2014especially when setting multiple attributes or using values returned by a function. Consider the following image:<\/p>\n<pre>&lt;img id=\"greatphoto\" src=\"brush-seller.jpg\" alt=\"brush seller\" \/&gt;<\/pre>\n    \n    <h4 id=\"setting-simple-attr\">Setting a simple attribute<\/h4>\n    <p>To change the <code>alt<\/code> attribute, simply pass the name of the attribute and its new value to the <code>.attr()<\/code> method:<\/p>\n    <pre>$('#greatphoto').attr('alt', 'Beijing Brush Seller');<\/pre>\n    <p><em>Add<\/em> an attribute the same way:<\/p>\n<pre>$('#greatphoto')\n.attr('title', 'Photo by Kelly Clark');<\/pre>\n\n    <h4 id=\"setting-several-attrs\">Setting several attributes at once<\/h4>\n    <p>To change the <code>alt<\/code> attribute and add the <code>title<\/code> attribute at the same time, pass both sets of names and values into the method at once using a map (JavaScript object literal). Each key-value pair in the map adds or modifies an attribute:<\/p>\n<pre>$('#greatphoto').attr({\n  alt: 'Beijing Brush Seller',\n  title: 'photo by Kelly Clark'\n});<\/pre>\n    <p>When setting multiple attributes, the quotes around attribute names are optional.<\/p>\n    <p><strong>WARNING<\/strong>: When setting the 'class' attribute, you must always use quotes!<\/p>\n    <p><strong>Note<\/strong>: jQuery prohibits changing the <code>type<\/code> attribute on an <code>&lt;input&gt;<\/code> or <code>&lt;button&gt;<\/code> element and will throw an error in all browsers. This is because the <code>type<\/code> attribute cannot be changed in Internet Explorer.<\/p>\n    <h4 id=\"computed-attr-values\">Computed attribute values<\/h4>\n    <p>By using a function to set attributes, you can compute the value based on other properties of the element. For example, to concatenate a new value with an existing value:<\/p>\n<pre>$('#greatphoto').attr('title', function(i, val) {\n  return val + ' - photo by Kelly Clark'\n});<\/pre>\n    <p>This use of a function to compute attribute values can be particularly useful when modifying the attributes of multiple elements at once.<\/p>\n    <p><strong>Note: <\/strong>If nothing is returned in the setter function (ie. <code>function(index, attr){})<\/code>, or if <code>undefined<\/code> is returned, the current value is not changed. This is useful for selectively setting values only when certain criteria are met.<\/p>\n  ","categories":["Attributes","Manipulation > General Attributes","Version > Version 1.0","Version > Version 1.1","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/attribute-contains-prefix-selector\/","name":"attributeContainsPrefix","title":"Attribute Contains Prefix Selector [name|=\"value\"]","type":"selector","signatures":[{"added":"1.0","params":[{"name":"attribute","type":"String","optional":"","desc":"An attribute name."},{"name":"value","type":"String","optional":"","desc":"An attribute value. Can be either an unquoted single word or a quoted string."}]}],"desc":"Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-).","longdesc":"<p>This selector was introduced into the CSS specification to handle language attributes.<\/p>","categories":["Selectors > Attribute","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/attribute-contains-selector\/","name":"attributeContains","title":"Attribute Contains Selector [name*=\"value\"]","type":"selector","signatures":[{"added":"1.0","params":[{"name":"attribute","type":"String","optional":"","desc":"An attribute name."},{"name":"value","type":"String","optional":"","desc":"An attribute value. Can be either an unquoted single word or a quoted string."}]}],"desc":"Selects elements that have the specified attribute with a value containing the a given substring.","longdesc":"<p>This is the most generous of the jQuery attribute selectors that match against a value. It will select an element if the selector's string appears anywhere within the element's attribute value. Compare this selector with the Attribute Contains Word selector (e.g. [attr~=\"word\"]), which is more appropriate in many cases.<\/p>","categories":["Selectors > Attribute","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/attribute-contains-word-selector\/","name":"attributeContainsWord","title":"Attribute Contains Word Selector [name~=\"value\"]","type":"selector","signatures":[{"added":"1.0","params":[{"name":"attribute","type":"String","optional":"","desc":"An attribute name."},{"name":"value","type":"String","optional":"","desc":"An attribute value. Can be either an unquoted single word or a quoted string."}]}],"desc":"Selects elements that have the specified attribute with a value containing a given word, delimited by spaces.","longdesc":"<p>This selector matches the test string against each word in the attribute value, where a \"word\" is defined as a string delimited by whitespace. The selector matches if the test string is exactly equal to any of the words.<\/p> ","categories":["Selectors > Attribute","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/attribute-ends-with-selector\/","name":"attributeEndsWith","title":"Attribute Ends With Selector [name$=\"value\"]","type":"selector","signatures":[{"added":"1.0","params":[{"name":"attribute","type":"String","optional":"","desc":"An attribute name."},{"name":"value","type":"String","optional":"","desc":"An attribute value. Can be either an unquoted single word or a quoted string."}]}],"desc":"Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive.","longdesc":"<longdesc\/>","categories":["Selectors > Attribute","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/attribute-equals-selector\/","name":"attributeEquals","title":"Attribute Equals Selector [name=\"value\"]","type":"selector","signatures":[{"added":"1.0","params":[{"name":"attribute","type":"String","optional":"","desc":"An attribute name."},{"name":"value","type":"String","optional":"","desc":"An attribute value. <strong>Can be either an unquoted single word or a quoted string.<\/strong>"}]}],"desc":"Selects elements that have the specified attribute with a value exactly equal to a certain value.","longdesc":"<longdesc\/>","categories":["Selectors > Attribute","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/attribute-not-equal-selector\/","name":"attributeNotEqual","title":"Attribute Not Equal Selector [name!=\"value\"]","type":"selector","signatures":[{"added":"1.0","params":[{"name":"attribute","type":"String","optional":"","desc":"An attribute name."},{"name":"value","type":"String","optional":"","desc":"An attribute value. Can be either an unquoted single word or a quoted string."}]}],"desc":"Select elements that either don't have the specified attribute, or do have the specified attribute but not with a certain value.","longdesc":"<p>This selector is equivalent to <code>:not([attr=\"value\"])<\/code>.<\/p> ","categories":["Selectors > Attribute","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/attribute-starts-with-selector\/","name":"attributeStartsWith","title":"Attribute Starts With Selector [name^=\"value\"]","type":"selector","signatures":[{"added":"1.0","params":[{"name":"attribute","type":"String","optional":"","desc":"An attribute name."},{"name":"value","type":"String","optional":"","desc":"An attribute value. Can be either an unquoted single word or a quoted string."}]}],"desc":"Selects elements that have the specified attribute with a value beginning exactly with a given string.","longdesc":"<p>This selector can be useful for identifying elements in pages produced by server-side frameworks that produce HTML with systematic element IDs. However it will be slower than using a class selector so leverage classes, if you can, to group like elements.<\/p>","categories":["Selectors > Attribute","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/before\/","name":"before","title":".before()","type":"method","signatures":[{"added":"1.0","params":[{"name":"content","type":"String, Element, jQuery","optional":"","desc":"HTML string, DOM element, or jQuery object to insert before each element in the set of matched elements."},{"name":"content","type":"String, Element, Array, jQuery","optional":"optional","desc":"One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements."}]},{"added":"1.4","params":[{"name":"function","type":"Function","optional":"","desc":"A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, <code>this<\/code> refers to the current element in the set.\n"}]}],"desc":"Insert content, specified by the parameter, before each element in the set of matched elements.","longdesc":"<p>The <code>.before()<\/code> and <code><a href=\"\/insertBefore\">.insertBefore()<\/a><\/code> methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With<code> .before()<\/code>, the selector expression preceding the method is the container before which the content is inserted. With <code>.insertBefore()<\/code>, on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted before the target container.<\/p>\n\t\t\t\t<p>Consider the following HTML:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>You can create content and insert it before several elements at once:<\/p>\n\t\t\t\t<pre>$('.inner').before('&lt;p&gt;Test&lt;\/p&gt;');<\/pre>\n\t\t\t\t<p>Each inner <code>&lt;div&gt;<\/code> element gets this new content:<\/p>\n<pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n  &lt;p&gt;Test&lt;\/p&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;p&gt;Test&lt;\/p&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n<p>You can also select an element on the page and insert it before another:<\/p>\n\t\t\t\t<pre>$('.container').before($('h2'));<\/pre>\n\t\t\t\t<p>If an element selected this way is inserted elsewhere, it will be moved before the target (not cloned):<\/p>\n\t\t\t\t<pre>&lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first.<\/p>\n<p>In jQuery 1.4, <code>.before()<\/code> and <code>.after()<\/code> will also work on disconnected DOM nodes:<\/p>\n<pre>$(\"&lt;div\/&gt;\").before(\"&lt;p&gt;&lt;\/p&gt;\");<\/pre>\n<p>The result is a jQuery set that contains a paragraph and a div (in that order).<\/p>\n   <h4 id=\"additional-arguments\">Additional Arguments<\/h4>\n    <p>Similar to other content-adding methods such as <code><a href=\"http:\/\/api.jquery.com\/prepend\/\">.prepend()<\/a><\/code> and <code><a href=\"http:\/\/api.jquery.com\/after\/\">.after()<\/a><\/code>, <code>.before()<\/code> also supports passing in multiple arguments as input. Supported input includes DOM elements, jQuery objects, HTML strings, and arrays of DOM elements.<\/p> \n    <p>For example, the following will insert two new <code>&lt;div&gt;<\/code>s and an existing <code>&lt;div&gt;<\/code> before the first paragraph:<\/p>\n<pre>var $newdiv1 = $('&lt;div id=\"object1\"\/&gt;'),\n    newdiv2 = document.createElement('div'),\n    existingdiv1 = document.getElementById('foo');\n\n$('p').first().before($newdiv1, [newdiv2, existingdiv1]);\n<\/pre>\n<p>Since <code>.before()<\/code> can accept any number of additional arguments, the same result can be achieved by passing in the three <code>&lt;div&gt;<\/code>s as three separate arguments, like so: <code>$('p').first().before($newdiv1, newdiv2, existingdiv1)<\/code>. The type and number of arguments will largely depend on how you collect the elements in your code.<\/p>\n\n","categories":["Manipulation > DOM Insertion"," Outside","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/bind\/","name":"bind","title":".bind()","type":"method","signatures":[{"added":"1.0","params":[{"name":"eventType","type":"String","optional":"","desc":"A string containing one or more DOM event types, such as \"click\" or \"submit,\" or custom event names."},{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventType","type":"String","optional":"","desc":"A string containing one or more DOM event types, such as \"click\" or \"submit,\" or custom event names."},{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"preventBubble","type":"Boolean","optional":"","desc":"Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true."}]},{"added":"1.4","params":[{"name":"events","type":"Object","optional":"","desc":"A map of one or more DOM event types and functions to execute for them."}]}],"desc":"Attach a handler to an event for the elements.","longdesc":"\n<p>As of jQuery 1.7, the <a href=\"http:\/\/api.jquery.com\/on\"><code>.on()<\/code><\/a> method is the preferred method for attaching event handlers to a document. For earlier versions, the <code>.bind()<\/code> method is used for attaching an event handler directly to elements. Handlers are attached to the currently selected elements in the jQuery object, so those elements <em>must exist<\/em> at the point the call to <code>.bind()<\/code> occurs. For more flexible event binding, see the discussion of event delegation in <a href=\"http:\/\/api.jquery.com\/on\"><code>.on()<\/code><\/a> or <a href=\"http:\/\/api.jquery.com\/delegate\"><code>.delegate()<\/code><\/a>.<\/p>\n\n<p>Any string is legal for <code>eventType<\/code>; if the string is not the name of a native DOM event, then the handler is bound to a custom event. These events are never called by the browser, but may be triggered manually from other JavaScript code using <code>.trigger()<\/code> or <code>.triggerHandler()<\/code>.<\/p>\n<p>If the <code>eventType<\/code> string contains a period (<code>.<\/code>) character, then the event is namespaced. The period character separates the event from its namespace. For example, in the call <code>.bind('click.name', handler)<\/code>, the string <code>click<\/code> is the event type, and the string <code>name<\/code> is the namespace. Namespacing allows us to unbind or trigger some events of a type without affecting others. See the discussion of <code>.unbind()<\/code> for more information.<\/p>\n\n<p>There are shorthand methods for some standard browser events such as <a href=\"\/click\"><code>.click()<\/code><\/a> that can be used to attach or trigger event handlers. For a complete list of shorthand methods, see the <a href=\"http:\/\/api.jquery.com\/category\/events\/\">events category<\/a>.<\/p>\n\n<p>When an event reaches an element, all handlers bound to that event type for the element are fired. If there are multiple handlers registered, they will always execute in the order in which they were bound. After all handlers have executed, the event continues along the normal event propagation path.<\/p>\n\n<p>A basic usage of <code>.bind()<\/code> is:<\/p>\n<pre>\n$('#foo').bind('click', function() {\n  alert('User clicked on \"foo.\"');\n});\n<\/pre>\n<p>This code will cause the element with an ID of <code>foo<\/code> to respond to the <code>click<\/code> event. When a user clicks inside this element thereafter, the alert will be shown.<\/p>\n<h4 id=\"multiple-events\">Multiple Events<\/h4>\n<p>Multiple event types can be bound at once by including each one separated by a space:<\/p>\n<pre>\n$('#foo').bind('mouseenter mouseleave', function() {\n  $(this).toggleClass('entered');\n});\n<\/pre>\n<p>The effect of this on <code>&lt;div id=\"foo\"&gt;<\/code> (when it does not initially have the \"entered\" class) is to add the \"entered\" class when the mouse enters the <code>&lt;div&gt;<\/code> and remove the class when the mouse leaves. <\/p>\n<p>As of jQuery 1.4 we can bind multiple event handlers simultaneously by passing a map of event type\/handler pairs:<\/p>\n<pre>\n$('#foo').bind({\n  click: function() {\n    \/\/ do something on click\n  },\n  mouseenter: function() {\n    \/\/ do something on mouseenter\n  }\n});\n<\/pre>\n<h4 id=\"event-handlers\">Event Handlers<\/h4>\n<p>The <code>handler<\/code> parameter takes a callback function, as shown above. Within the handler, the keyword <code>this<\/code> refers to the DOM element to which the handler is bound. To make use of the element in jQuery, it can be passed to the normal <code>$()<\/code> function. For example:<\/p>\n<pre>$('#foo').bind('click', function() {\n  alert($(this).text());\n});\n<\/pre>\n<p>After this code is executed, when the user clicks inside the element with an ID of <code>foo<\/code>, its text contents will be shown as an alert.\n<\/p>\n<p>As of jQuery 1.4.2 duplicate event handlers can be bound to an element instead of being discarded. This is useful when the event data feature is being used, or when other unique data resides in a closure around the event handler function.<\/p>\n\n<p>In jQuery 1.4.3 you can now pass in <code>false<\/code> in place of an event handler. This will bind an event handler equivalent to: <code>function(){ return false; }<\/code>. This function can be removed at a later time by calling: <code>.unbind( eventName, false )<\/code>.<\/p>\n\n<h4 id=\"event-object\"><a href=\"http:\/\/api.jquery.com\/category\/events\/event-object\/\">The Event object<\/a><\/h4>\n\n<p>The <code>handler<\/code> callback function can also take parameters. When the function is called, the event object will be passed to the first parameter.<\/p>\n<p>The event object is often unnecessary and the parameter omitted, as sufficient context is usually available when the handler is bound to know exactly what needs to be done when the handler is triggered. However, at times it becomes necessary to gather more information about the user's environment at the time the event was initiated. <a href=\"http:\/\/api.jquery.com\/category\/events\/event-object\/\">View the full Event Object<\/a>.<\/p>\n\n<p>Returning <code>false<\/code> from a handler is equivalent to calling both <code>.preventDefault()<\/code> and <code>.stopPropagation()<\/code> on the event object.<\/p>\n<p>Using the event object in a handler looks like this:<\/p>\n<pre>$(document).ready(function() {\n  $('#foo').bind('click', function(event) {\n    alert('The mouse cursor is at ('\n      + event.pageX + ', ' + event.pageY + ')');\n  });\n});\n<\/pre>\n<p>Note the parameter added to the anonymous function. This code will cause a click on the element with ID <code>foo<\/code> to report the page coordinates of the mouse cursor at the time of the click.<\/p>\n\n<h4 id=\"passing-event-data\">Passing Event Data<\/h4>\n<p>The optional <code>eventData<\/code> parameter is not commonly used. When provided, this argument allows us to pass additional information to the handler. One handy use of this parameter is to work around issues caused by closures. For example, suppose we have two event handlers that both refer to the same external variable:<\/p>\n<pre>var message = 'Spoon!';\n$('#foo').bind('click', function() {\n  alert(message);\n});\nmessage = 'Not in the face!';\n$('#bar').bind('click', function() {\n  alert(message);\n});\n<\/pre>\n<p>Because the handlers are closures that both have <code>message<\/code> in their environment, both will display the message <span class=\"output\">Not in the face!<\/span> when triggered. The variable's value has changed. To sidestep this, we can pass the message in using <code>eventData<\/code>:\n<\/p>\n<pre>var message = 'Spoon!';\n$('#foo').bind('click', {msg: message}, function(event) {\n  alert(event.data.msg);\n});\nmessage = 'Not in the face!';\n$('#bar').bind('click', {msg: message}, function(event) {\n  alert(event.data.msg);\n});\n<\/pre>\n<p>This time the variable is not referred to directly within the handlers; instead, the variable is passed in <em>by value<\/em> through <code>eventData<\/code>, which fixes the value at the time the event is bound. The first handler will now display <span class=\"output\">Spoon!<\/span> while the second will alert <span class=\"output\">Not in the face!<\/span>\n<\/p>\n<blockquote>\n  <p>Note that objects are passed to functions <em>by reference<\/em>, which further complicates this scenario.<\/p>\n<\/blockquote>\n<p>If <code>eventData<\/code> is present, it is the second argument to the <code>.bind()<\/code> method; if no additional data needs to be sent to the handler, then the callback is passed as the second and final argument.<\/p>\n<blockquote><p>See the <code>.trigger()<\/code> method reference for a way to pass data to a handler at the time the event happens rather than when the handler is bound.<\/p><\/blockquote>\n\n<p>As of jQuery 1.4 we can no longer attach data (and thus, events) to object, embed, or applet elements because critical errors occur when attaching data to Java applets.<\/p>\n<p><strong>Note: <\/strong>Although demonstrated in the next example, it is inadvisable to bind handlers to both the <code>click<\/code> and <code>dblclick<\/code> events for the same element. The sequence of events triggered varies from browser to browser, with some receiving two click events before the <code>dblclick<\/code> and others only one. Double-click sensitivity (maximum time between clicks that is detected as a double click) can vary by operating system and browser, and is often user-configurable.<\/p>\n","categories":["Events > Event Handler Attachment","Version > Version 1.0","Version > Version 1.4","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/blur\/","name":"blur","title":".blur()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"blur\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('blur', handler)<\/code> in the first two variations, and <code>.trigger('blur')<\/code> in the third.<\/p>\n<p>The <code>blur<\/code> event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as <code>&lt;input&gt;<\/code>. In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;form&gt;\n  &lt;input id=\"target\" type=\"text\" value=\"Field 1\" \/&gt;\n  &lt;input type=\"text\" value=\"Field 2\" \/&gt;\n&lt;\/form&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;\nThe event handler can be bound to the first input field:\n$('#target').blur(function() {\n  alert('Handler for .blur() called.');\n});<\/pre>\n<p>Now if the first field has the focus, clicking elsewhere or tabbing away from it displays the alert:<\/p>\n<p><span class=\"output\">Handler for .blur() called.<\/span><\/p>\n<p>To trigger the event programmatically, apply <code>.blur()<\/code> without an argument:<\/p>\n<pre>$('#other').click(function() {\n  $('#target').blur();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also alert the message.<\/p>\n<p>The <code>blur<\/code> event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the <code>blur<\/code> event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping <code>blur<\/code> to the <code>focusout<\/code> event in its event delegation methods, <a href=\"http:\/\/api.jquery.com\/live\/\"><code>.live()<\/code><\/a> and <a href=\"http:\/\/api.jquery.com\/delegate\/\"><code>.delegate()<\/code><\/a>.<\/p>\n","categories":["Events > Form Events","Forms","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/button-selector\/","name":"button","title":":button Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all button elements and elements of type button.","longdesc":"\n    <p>An equivalent selector to <code>$(\":button\")<\/code> using valid CSS is <code>$(\"button, input[type='button']\")<\/code>.<\/p>\n  ","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/callbacks.add\/","name":"callbacks.add","title":"callbacks.add()","type":"","signatures":[{"added":"1.7","params":[{"name":"callbacks","type":"Function","optional":"","desc":"A function, or array of functions, that are to be added to the callback list."}]}],"desc":"Add a callback or a collection of callbacks to a callback list.","longdesc":"\n<h2 id=\"example-1\">Example<\/h2>\n<p>Using <code>callbacks.add()<\/code> to add new callbacks to a callback list:<\/p>\n<pre>\n\/\/ a sample logging function to be added to a callbacks list\nvar foo = function( value ){\n    console.log( 'foo:' + value );\n}\n\n\/\/ another function to also be added to the list\nvar bar = function( value ){\n    console.log( 'bar:' + value );\n}\n\nvar callbacks = $.Callbacks();\n\n\/\/ add the function 'foo' to the list\ncallbacks.add( foo );\n\n\/\/ fire the items on the list\ncallbacks.fire( 'hello' );  \n\/\/ outputs: 'foo: hello'\n\n\/\/ add the function 'bar' to the list\ncallbacks.add( bar );\n\n\/\/ fire the items on the list again\ncallbacks.fire( 'world' );  \n\n\/\/ outputs:\n\/\/ 'foo: world'\n\/\/ 'bar: world'\n<\/pre>\n\n  ","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/callbacks.disable\/","name":"callbacks.disable","title":"callbacks.disable()","type":"","signatures":[{"added":"1.7"}],"desc":"Disable a callback list from doing anything more.","longdesc":"\n<h2 id=\"example-1\">Example<\/h2>\n<p>Using <code>callbacks.disable()<\/code> to disable further calls being made to a callback list:<\/p>\n<pre>\n\/\/ a sample logging function to be added to a callbacks list\nvar foo = function( value ){\n    console.log( value );\n}\n\nvar callbacks = $.Callbacks();\n\n\/\/ add the above function to the list\ncallbacks.add( foo );\n\n\/\/ fire the items on the list\ncallbacks.fire( 'foo' ); \/\/ outputs: foo\n\n\/\/ disable further calls being possible\ncallbacks.disable();\n\n\/\/ attempt to fire with 'foobar' as an argument\ncallbacks.fire( 'foobar' ); \/\/ foobar isn't output\n<\/pre>\n  ","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/callbacks.empty\/","name":"callbacks.empty","title":"callbacks.empty()","type":"","signatures":[{"added":"1.7"}],"desc":"Remove all of the callbacks from a list.","longdesc":"\n<h2 id=\"example-1\">Example<\/h2>\n<p>Using <code>callbacks.empty()<\/code> to empty a list of callbacks:<\/p>\n<pre>\n\/\/ a sample logging function to be added to a callbacks list\nvar foo = function( value1, value2 ){\n    console.log( 'foo:' + value1 + ',' + value2 );\n}\n\n\/\/ another function to also be added to the list\nvar bar = function( value1, value2 ){\n    console.log( 'bar:' + value1 + ',' + value2 );\n}\n\nvar callbacks = $.Callbacks();\n\n\/\/ add the two functions\ncallbacks.add( foo );\ncallbacks.add( bar );\n\n\/\/ empty the callbacks list\ncallbacks.empty();\n\n\/\/ check to ensure all callbacks have been removed\nconsole.log( callbacks.has( foo ) ); \/\/ false\nconsole.log( callbacks.has( bar ) ); \/\/ false\n<\/pre>\n  ","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/callbacks.fire\/","name":"callbacks.fire","title":"callbacks.fire()","type":"","signatures":[{"added":"1.7","params":[{"name":"arguments","type":"","optional":"","desc":"The argument or list of arguments to pass back to the callback list."}]}],"desc":"Call all of the callbacks with the given arguments","longdesc":"\n<h2 id=\"example-1\">Example<\/h2>\n<p>Using <code>callbacks.fire()<\/code> to invoke the callbacks in a list with any arguments that have been passed:<\/p>\n<pre>\n\/\/ a sample logging function to be added to a callbacks list\nvar foo = function( value ){\n    console.log( 'foo:' + value );\n}\n\nvar callbacks = $.Callbacks();\n\n\/\/ add the function 'foo' to the list\ncallbacks.add( foo );\n\n\/\/ fire the items on the list\ncallbacks.fire( 'hello' ); \/\/ outputs: 'foo: hello'\ncallbacks.fire( 'world '); \/\/ outputs: 'foo: world'\n\n\/\/ add another function to the list\nvar bar = function( value ){\n    console.log( 'bar:' + value );\n} \n\n\/\/ add this function to the list\ncallbacks.add( bar );\n\n\/\/ fire the items on the list again\ncallbacks.fire( 'hello again' );\n\/\/ outputs:\n\/\/ 'foo: hello again'\n\/\/ 'bar: hello again'\n<\/pre>\n  ","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/callbacks.fired\/","name":"callbacks.fired","title":"callbacks.fired()","type":"","signatures":[{"added":"1.7"}],"desc":"Determine if the callbacks have already been called at least once.","longdesc":"\n<h2 id=\"example-1\">Example<\/h2>\n<p>Using <code>callbacks.fired()<\/code> to determine if the callbacks in a list have been called at least once:<\/p>\n<pre>\n\/\/ a sample logging function to be added to a callbacks list\nvar foo = function( value ){\n    console.log( 'foo:' + value );\n}\n\nvar callbacks = $.Callbacks();\n\n\/\/ add the function 'foo' to the list\ncallbacks.add( foo );\n\n\/\/ fire the items on the list\ncallbacks.fire( 'hello' ); \/\/ outputs: 'foo: hello'\ncallbacks.fire( 'world '); \/\/ outputs: 'foo: world'\n\n\/\/ test to establish if the callbacks have been called\nconsole.log( callbacks.fired() );\n<\/pre>\n  ","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/callbacks.fireWith\/","name":"callbacks.fireWith","title":"callbacks.fireWith()","type":"","signatures":[{"added":"1.7","params":[{"name":"context","type":"","optional":"optional","desc":"A reference to the context in which the callbacks in the list should be fired."},{"name":"args","type":"","optional":"optional","desc":"An argument, or array of arguments, to pass to the callbacks in the list."}]}],"desc":"Call all callbacks in a list with the given context and arguments.","longdesc":"\n<h2 id=\"example-1\">Example<\/h2>\n<p>Using <code>callbacks.fireWith()<\/code> to fire a list of callbacks with a specific context and an array of arguments:<\/p>\n<pre>\n\/\/ a sample logging function to be added to a callbacks list\nvar log = function( value1, value2 ){\n    console.log( 'Received:' + value1 + ',' + value2 );\n}\n\nvar callbacks = $.Callbacks();\n\n\/\/ add the log method to the callbacks list\ncallbacks.add( log );\n\n\/\/ fire the callbacks on the list using the context 'window'\n\/\/ and an arguments array\n\ncallbacks.fireWith( window, ['foo','bar']);\n\n\/\/ outputs: Received: foo, bar\n<\/pre>\n  ","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/callbacks.has\/","name":"callbacks.has","title":"callbacks.has()","type":"","signatures":[{"added":"1.7","params":[{"name":"callback","type":"Function","optional":"","desc":"The callback to search for."}]}],"desc":"Determine whether a supplied callback is in a list","longdesc":"\n<h2 id=\"example-1\">Example<\/h2>\n<p>Using <code>callbacks.has()<\/code> to check if a callback list contains a specific callback:<\/p>\n<pre>\n\/\/ a sample logging function to be added to a callbacks list\nvar foo = function( value1, value2 ){\n    console.log( 'Received:' + value1 + ',' + value2 );\n}\n\n\/\/ a second function which will not be added to the list\nvar bar = function( value1, value2 ){\n    console.log( 'foobar');\n}\n\nvar callbacks = $.Callbacks();\n\n\/\/ add the log method to the callbacks list\ncallbacks.add( foo );\n\n\/\/ determine which callbacks are in the list\n\nconsole.log( callbacks.has( foo ) ); \/\/ true\nconsole.log( callbacks.has( bar ) ); \/\/ false\n<\/pre>\n  ","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/callbacks.lock\/","name":"callbacks.lock","title":"callbacks.lock()","type":"","signatures":[{"added":"1.7"}],"desc":"Lock a callback list in its current state.","longdesc":"\n<h2 id=\"example-1\">Example<\/h2>\n<p>Using <code>callbacks.lock()<\/code> to lock a callback list to avoid further changes being made to the list state:<\/p>\n<pre>\n\/\/ a sample logging function to be added to a callbacks list\nvar foo = function( value ){\n    console.log( 'foo:' + value);\n}\n\nvar callbacks = $.Callbacks();\n\n\/\/ add the logging function to the callback list\ncallbacks.add( foo );\n\n\/\/ fire the items on the list, passing an argument\ncallbacks.fire( 'hello' );\n\/\/ outputs 'foo: hello'\n\n\/\/ lock the callbacks list\ncallbacks.lock();\n\n\/\/ try firing the items again\ncallbacks.fire( 'world' );\n\n\/\/ as the list was locked, no items\n\/\/ were called so 'world' isn't logged\n<\/pre>\n\n  ","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/callbacks.locked\/","name":"callbacks.locked","title":"callbacks.locked()","type":"","signatures":[{"added":"1.7"}],"desc":"Determine if the callbacks list has been locked.","longdesc":"\n\n<h2 id=\"example-1\">Example<\/h2>\n<p>Using <code>callbacks.locked()<\/code> to determine the lock-state of a callback list:<\/p>\n<pre>\n\/\/ a sample logging function to be added to a callbacks list\nvar foo = function( value ){\n    console.log( 'foo:' + value);\n}\n\nvar callbacks = $.Callbacks();\n\n\/\/ add the logging function to the callback list\ncallbacks.add( foo );\n\n\/\/ fire the items on the list, passing an argument\ncallbacks.fire( 'hello' );\n\/\/ outputs 'foo: hello'\n\n\/\/ lock the callbacks list\ncallbacks.lock();\n\n\/\/ test the lock-state of the list\nconsole.log ( callbacks.locked() ); \/\/true\n<\/pre>\n\n  ","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/callbacks.remove\/","name":"callbacks.remove","title":"callbacks.remove()","type":"","signatures":[{"added":"1.7","params":[{"name":"callbacks","type":"Function","optional":"","desc":"A function, or array of functions, that are to be removed from the callback list."}]}],"desc":"Remove a callback or a collection of callbacks from a callback list.","longdesc":"\n<h2 id=\"example-1\">Example<\/h2>\n<p>Using <code>callbacks.remove()<\/code> to remove callbacks from a callback list:<\/p>\n<pre>\n\/\/ a sample logging function to be added to a callbacks list\nvar foo = function( value ){\n    console.log( 'foo:' + value );\n}\n\nvar callbacks = $.Callbacks();\n\n\/\/ add the function 'foo' to the list\ncallbacks.add( foo );\n\n\/\/ fire the items on the list\ncallbacks.fire( 'hello' ); \/\/ outputs: 'foo: hello'\n\n\/\/ remove 'foo' from the callback list\ncallbacks.remove( foo );\n\n\/\/ fire the items on the list again\ncallbacks.fire( 'world' );  \n\n\/\/ nothing output as 'foo' is no longer in the list\n<\/pre>\n\n  ","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/change\/","name":"change","title":".change()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"change\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('change', handler)<\/code> in the first two variations, and <code>.trigger('change')<\/code> in the third.<\/p>\n<p>The <code>change<\/code> event is sent to an element when its value changes. This event is limited to <code>&lt;input&gt;<\/code> elements, <code>&lt;textarea&gt;<\/code> boxes and <code>&lt;select&gt;<\/code> elements. For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element types the event is deferred until the element loses focus.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;form&gt;\n  &lt;input class=\"target\" type=\"text\" value=\"Field 1\" \/&gt;\n  &lt;select class=\"target\"&gt;\n    &lt;option value=\"option1\" selected=\"selected\"&gt;Option 1&lt;\/option&gt;\n    &lt;option value=\"option2\"&gt;Option 2&lt;\/option&gt;\n  &lt;\/select&gt;\n&lt;\/form&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;<\/pre>\n<p>The event handler can be bound to the text input and the select box:<\/p>\n<pre>$('.target').change(function() {\n  alert('Handler for .change() called.');\n});<\/pre>\n<p>Now when the second option is selected from the dropdown, the alert is displayed. It is also displayed if you change the text in the field and then click away. If the field loses focus without the contents having changed, though, the event is not triggered. To trigger the event manually, apply <code>.change()<\/code> without arguments:<\/p>\n<pre>$('#other').click(function() {\n  $('.target').change();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also alert the message. The message will display twice, because the handler has been bound to the <code>change<\/code> event on both of the form elements.<\/p>\n<p>As of jQuery 1.4, the <code>change<\/code> event bubbles in Internet Explorer, behaving consistently with the event in other modern browsers.<\/p>\n","categories":["Events > Form Events","Forms","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/checkbox-selector\/","name":"checkbox","title":":checkbox Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements of type checkbox.","longdesc":"<p><code>$(':checkbox')<\/code> is equivalent to <code>$('[type=checkbox]')<\/code>. As with other pseudo-class selectors (those that begin with a \":\") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector (\"*\") is implied. In other words, the bare <code>$(':checkbox')<\/code> is equivalent to <code>$('*:checkbox')<\/code>, so <code>$('input:checkbox')<\/code> should be used instead. <\/p>\n","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/checked-selector\/","name":"checked","title":":checked Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Matches all elements that are checked.","longdesc":"<p>The <code>:checked<\/code> selector works for checkboxes and radio buttons. For select elements, use the <code>:selected<\/code> selector.<\/p>","categories":["Selectors > Form","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/child-selector\/","name":"child","title":"Child Selector (\"parent > child\")","type":"selector","signatures":[{"added":"1.0","params":[{"name":"parent","type":"Selector","optional":"","desc":"Any valid selector."},{"name":"child","type":"Selector","optional":"","desc":"A selector to filter the child elements."}]}],"desc":"Selects all direct child elements specified by \"child\" of elements specified by \"parent\".","longdesc":"<p>As a CSS selector, the child combinator is supported by all modern web browsers including Safari, Firefox, Opera, Chrome, and Internet Explorer 7 and above, but notably not by Internet Explorer versions 6 and below. However, in jQuery, this selector (along with all others) works across all supported browsers, including IE6.<\/p>\n    <p>The child combinator (E <strong>&gt;<\/strong> F) can be thought of as a more specific form of the descendant combinator (E F) in that it selects only first-level descendants.<\/p>\n<blockquote><p><strong>Note: <\/strong>The <code>$(\"&gt; elem\", context)<\/code> selector will be deprecated in a future release. Its usage is thus discouraged in lieu of using alternative selectors.<\/p><\/blockquote>\n","categories":["Selectors > Hierarchy","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/children\/","name":"children","title":".children()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get the children of each element in the set of matched elements, optionally filtered by a selector.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.children()<\/code> method allows us to search through the children of these elements in the DOM tree and construct a new jQuery object from the matching elements. The <code>.children()<\/code> method differs from <code><a href=\"http:\/\/api.jquery.com\/find\/\">.find()<\/a><\/code> in that <code>.children()<\/code> only travels a single level down the DOM tree while <code>.find()<\/code> can traverse down multiple levels to select descendant elements (grandchildren, etc.) as well. Note also that like most jQuery methods, <code>.children()<\/code> does not return text nodes; to get <em>all<\/em> children including text and comment nodes, use <code><a href=\"http:\/\/api.jquery.com\/contents\">.contents()<\/a><\/code>.<\/p>\n<p>The <code>.children()<\/code> method optionally accepts a selector expression of the same type that we can pass to the <code>$()<\/code> function. If the selector is supplied, the elements will be filtered by testing whether they match it.<\/p>\n<p>Consider a page with a basic nested list on it:<\/p>\n<pre>\n&lt;ul class=\"level-1\"&gt;\n  &lt;li class=\"item-i\"&gt;I&lt;\/li&gt;\n  &lt;li class=\"item-ii\"&gt;II\n    &lt;ul class=\"level-2\"&gt;\n      &lt;li class=\"item-a\"&gt;A&lt;\/li&gt;\n      &lt;li class=\"item-b\"&gt;B\n        &lt;ul class=\"level-3\"&gt;\n          &lt;li class=\"item-1\"&gt;1&lt;\/li&gt;\n          &lt;li class=\"item-2\"&gt;2&lt;\/li&gt;\n          &lt;li class=\"item-3\"&gt;3&lt;\/li&gt;\n        &lt;\/ul&gt;\n      &lt;\/li&gt;\n      &lt;li class=\"item-c\"&gt;C&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/li&gt;\n  &lt;li class=\"item-iii\"&gt;III&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>If we begin at the level-2 list, we can find its children:<\/p>\n<pre>$('ul.level-2').children().css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background behind items A, B, and C. Since we do not supply a selector expression, all of the children are part of the returned jQuery object. If we had supplied one, only the matching items among these three would be included.<\/p>","categories":["Traversing > Tree Traversal","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/class-selector\/","name":"class","title":"Class Selector (\".class\")","type":"selector","signatures":[{"added":"1.0","params":[{"name":"class","type":"String","optional":"","desc":"A class to search for. An element can have multiple classes; only one of them must match."}]}],"desc":"Selects all elements with the given class. ","longdesc":"<p>For class selectors, jQuery uses JavaScript's native <code>getElementsByClassName()<\/code> function if the browser supports it.<\/p>\n                \n","categories":["Selectors > Basic","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/clearQueue\/","name":"clearQueue","title":".clearQueue()","type":"method","signatures":[{"added":"1.4","params":[{"name":"queueName","type":"String","optional":"optional","desc":"A string containing the name of the queue. Defaults to <code>fx<\/code>, the standard effects queue."}]}],"desc":"Remove from the queue all items that have not yet been run.","longdesc":"<p>When the <code>.clearQueue()<\/code> method is called, all functions on the queue that have not been executed are removed from the queue. When used without an argument, <code>.clearQueue()<\/code> removes the remaining functions from <code>fx<\/code>, the standard effects queue. In this way it is similar to <code>.stop(true)<\/code>. However,  while the <code>.stop()<\/code> method is meant to be used only with animations, <code>.clearQueue()<\/code> can also be used to remove any function that has been added to a generic jQuery queue with the <code>.queue()<\/code> method. <\/p>","categories":["Effects > Custom","Data","Utilities","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/click\/","name":"click","title":".click()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"click\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>In the first two variations, this method is a shortcut for <code>.bind(\"click\", handler)<\/code>, as well as for <code>.on(\"click\", handler)<\/code> as of jQuery 1.7. In the third variation, when <code>.click()<\/code> is called without arguments, it is a shortcut for <code>.trigger(\"click\")<\/code>. <\/p>\n<p>The <code>click<\/code> event is sent to an element when the mouse pointer is over the element, and the mouse button is pressed and released. Any HTML element can receive this event.<\/p>\n<pre>For example, consider the HTML:\n&lt;div id=\"target\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;<\/pre>\n\n<p class=\"image\"><img src=\"\/images\/0042_05_03.png\" alt=\"\"\/><\/p>\n<p>The event handler can be bound to any <code>&lt;div&gt;<\/code>:<\/p>\n<pre>$(\"#target\").click(function() {\n  alert(\"Handler for .click() called.\");\n});<\/pre>\n<p>Now if we click on this element, the alert is displayed:<\/p>\n<p><span class=\"output\">Handler for .click() called.<\/span><\/p>\n<p>We can also trigger the event when a different element is clicked:<\/p>\n<pre>$(\"#other\").click(function() {\n  $(\"#target\").click();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also alert the message.<\/p>\n<p>The <code>click<\/code> event is only triggered after this exact series of events:<\/p>\n<ul>\n  <li>The mouse button is depressed while the pointer is inside the element.<\/li>\n  <li>The mouse button is released while the pointer is inside the element.<\/li>\n<\/ul>\n<p>This is usually the desired sequence before taking an action. If this is not required, the <code>mousedown<\/code> or <code>mouseup<\/code> event may be more suitable.<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/clone\/","name":"clone","title":".clone()","type":"method","signatures":[{"added":"1.0","params":[{"name":"withDataAndEvents","type":"Boolean","optional":"optional","desc":"A Boolean indicating whether event handlers should be copied along with the elements. As of jQuery 1.4, element data will be copied as well."}]},{"added":"1.5","params":[{"name":"withDataAndEvents","type":"Boolean","optional":"optional","desc":"A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is <code>false<\/code>. <em>*In jQuery 1.5.0 the default value was incorrectly <code>true<\/code>; it was changed back to <code>false<\/code> in 1.5.1 and up.<\/em>"},{"name":"deepWithDataAndEvents","type":"Boolean","optional":"optional","desc":"A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to <code>false<\/code>)."}]}],"desc":"Create a deep copy of the set of matched elements.","longdesc":"<p>The <code>.clone()<\/code> method performs a <em>deep<\/em> copy of the set of matched elements, meaning that it copies the matched elements as well as all of their descendant elements and text nodes. When used in conjunction with one of the insertion methods, <code>.clone()<\/code> is a convenient way to duplicate elements on a page. Consider the following HTML:<\/p>\n        <pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"hello\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"goodbye\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n        <p>As shown in the discussion for <code><a href=\"http:\/\/api.jquery.com\/append\/\">.append()<\/a><\/code>,  normally when an element is inserted somewhere in the DOM, it is moved from its old location. So, given the code:<\/p>\n<pre>$('.hello').appendTo('.goodbye');<\/pre>\n    <p>The resulting DOM structure would be:<\/p>\n<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"goodbye\"&gt;\n    Goodbye\n    &lt;div class=\"hello\"&gt;Hello&lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n        <p>To prevent this and instead create a copy of the element, you could write the following:<\/p>\n        <pre>$('.hello').clone().appendTo('.goodbye');<\/pre>\n        <p>This would produce:<\/p>\n        <pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"hello\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"goodbye\"&gt;\n    Goodbye\n    &lt;div class=\"hello\"&gt;Hello&lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n        <blockquote><p><strong>Note:<\/strong> When using the <code>.clone()<\/code> method, you can modify the cloned elements or their contents before (re-)inserting them into the document.<\/p><\/blockquote>\n        <p>Normally, any event handlers bound to the original element are <em>not<\/em> copied to the clone. The optional <code>withDataAndEvents<\/code> parameter allows us to change this behavior, and to instead make copies of all of the event handlers as well, bound to the new copy of the element. As of jQuery 1.4, all element data (attached by the <code>.data()<\/code> method) is also copied to the new copy. <\/p>\n<p>However, objects and arrays within element data are not copied and will continue to be shared between the cloned element and the original element. To deep copy all data, copy each one manually:<\/p>\n<pre>var $elem = $('#elem').data( \"arr\": [ 1 ] ), \/\/ Original element with attached data\n    $clone = $elem.clone( true )\n    .data( \"arr\", $.extend( [], $elem.data(\"arr\") ) ); \/\/ Deep copy to prevent data sharing\n<\/pre>\n    <p>As of jQuery 1.5, <code>withDataAndEvents<\/code> can be optionally enhanced with <code>deepWithDataAndEvents <\/code> to copy the events and data for all children of the cloned element.<\/p>\n<blockquote><p><strong>Note:<\/strong> Using <code>.clone()<\/code> has the side-effect of producing elements with duplicate <code>id<\/code> attributes, which are supposed to be unique. Where possible, it is recommended to avoid cloning elements with this attribute or using <code>class<\/code> attributes as identifiers instead.<\/p><\/blockquote>\n  ","categories":["Manipulation > Copying","Version > Version 1.0","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/closest\/","name":"closest","title":".closest()","type":"method","signatures":[{"added":"1.3","params":[{"name":"selector","type":"Selector","optional":"","desc":"A string containing a selector expression to match elements against."}]},{"added":"1.4","params":[{"name":"selector","type":"Selector","optional":"","desc":"A string containing a selector expression to match elements against."},{"name":"context","type":"Element","optional":"optional","desc":"A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead."}]},{"added":"1.6","params":[{"name":"jQuery object","type":"jQuery","optional":"","desc":"A jQuery object to match elements against."}]},{"added":"1.6","params":[{"name":"element","type":"Element","optional":"","desc":"An element to match elements against."}]}],"desc":"Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.closest()<\/code> method searches through these elements and their ancestors in the DOM tree and constructs a new jQuery object from the matching elements. The <code>.parents()<\/code> and <code>.closest()<\/code> methods are similar in that they both traverse up the DOM tree. The differences between the two, though subtle, are significant:<\/p>\n\n  <table>\n    <thead>\n      <tr>\n        <th>.closest()<\/th>\n        <th>.parents()<\/th>\n      <\/tr>\n    <\/thead>\n    <tbody>\n      <tr>\n        <td>Begins with the current element<\/td>\n        <td>Begins with the parent element<\/td><\/tr>\n      <tr>\n        <td>Travels up the DOM tree until it finds a match for the supplied selector<\/td>\n        <td>Travels up the DOM tree to the document's root element, adding each ancestor element to a temporary collection; it then filters that collection based on a selector if one is supplied <\/td>\n      <\/tr>\n      <tr>\n        <td>The returned jQuery object contains zero or one element<\/td>\n        <td>The returned jQuery object contains zero, one, or multiple elements<\/td>\n      <\/tr>\n    <\/tbody>\n  <\/table>\n\n<pre>\n&lt;ul id=\"one\" class=\"level-1\"&gt;\n  &lt;li class=\"item-i\"&gt;I&lt;\/li&gt;\n  &lt;li id=\"ii\" class=\"item-ii\"&gt;II\n  &lt;ul class=\"level-2\"&gt;\n    &lt;li class=\"item-a\"&gt;A&lt;\/li&gt;\n    &lt;li class=\"item-b\"&gt;B\n      &lt;ul class=\"level-3\"&gt;\n        &lt;li class=\"item-1\"&gt;1&lt;\/li&gt;\n        &lt;li class=\"item-2\"&gt;2&lt;\/li&gt;\n        &lt;li class=\"item-3\"&gt;3&lt;\/li&gt;\n      &lt;\/ul&gt;\n    &lt;\/li&gt;\n    &lt;li class=\"item-c\"&gt;C&lt;\/li&gt;\n  &lt;\/ul&gt;\n  &lt;\/li&gt;\n  &lt;li class=\"item-iii\"&gt;III&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n\n<p>Suppose we perform a search for <code>&lt;ul&gt;<\/code> elements starting at item A:<\/p>\n<pre>\n$('li.item-a').closest('ul')\n  .css('background-color', 'red');\n<\/pre>\n<p>This will change the color of the level-2 <code>&lt;ul&gt;<\/code>, since it is the first encountered when traveling up the DOM tree.<\/p>\n<p>Suppose we search for an <code>&lt;li&gt;<\/code> element instead:<\/p>\n<pre>$('li.item-a').closest('li')\n  .css('background-color', 'red');\n<\/pre>\n<p>This will change the color of list item A. The <code>.closest()<\/code> method begins its search <em>with the element itself<\/em> before progressing up the DOM tree, and stops when item A matches the selector.<\/p>\n<p>We can pass in a DOM element as the context within which to search for the closest element.<\/p>\n<pre>var listItemII = document.getElementById('ii');\n$('li.item-a').closest('ul', listItemII)\n  .css('background-color', 'red');\n$('li.item-a').closest('#one', listItemII)\n  .css('background-color', 'green');<\/pre>\n<p>This will change the color of the level-2 <code>&lt;ul&gt;<\/code>, because it is both the first <code>&lt;ul&gt;<\/code> ancestor of list item A and a descendant of list item II. It will not change the color of the level-1 <code>&lt;ul&gt;<\/code>, however, because it is not a descendant of list item II.<\/p>\n","categories":["Traversing > Tree Traversal","Version > Version 1.3","Version > Version 1.4","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/closest\/","name":"closest","title":".closest()","type":"method","signatures":[{"added":"1.4","params":[{"name":"selectors","type":"Array","optional":"","desc":"An array or string containing a selector expression to match elements against (can also be a jQuery object)."},{"name":"context","type":"Element","optional":"optional","desc":"A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead."}]}],"desc":"Gets an array of all the elements and selectors matched against the current element up through the DOM tree.","longdesc":"<p><strong>This signature (only!) is deprecated as of jQuery 1.7.<\/strong> This method is primarily meant to be used internally or by plugin authors.<\/p>","categories":["Traversing > Tree Traversal","Version > Version 1.3","Version > Version 1.4","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/contains-selector\/","name":"contains","title":":contains() Selector","type":"selector","signatures":[{"added":"1.1.4","params":[{"name":"text","type":"String","optional":"","desc":"A string of text to look for. It's case sensitive."}]}],"desc":"Select all elements that contain the specified text.","longdesc":"<p>The matching text can appear directly within the selected element, in any of that element's descendants, or a combination thereof. As with attribute value selectors, text inside the parentheses of <code>:contains()<\/code> can be written as a bare word or surrounded by quotation marks. The text must have matching case to be selected.<\/p>","categories":["Selectors > Content Filter","Version > Version 1.1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/contents\/","name":"contents","title":".contents()","type":"method","signatures":[{"added":"1.2"}],"desc":"Get the children of each element in the set of matched elements, including text and comment nodes.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.contents()<\/code> method allows us to search through the immediate children of these elements in the DOM tree and construct a new jQuery object from the matching elements. The <code>.contents()<\/code> and <code>.children()<\/code> methods are similar, except that the former includes text nodes as well as HTML elements in the resulting jQuery object.<\/p>\n<p>The <code>.contents()<\/code> method can also be used to get the content document of an iframe, if the iframe is on the same domain as the main page.<\/p>\n<p>Consider a simple <code>&lt;div&gt;<\/code> with a number of text nodes, each of which is separated by two line break elements (<code>&lt;br \/&gt;<\/code>):<\/p>\n<pre>&lt;div class=\"container\"&gt;\n  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed \n  do eiusmod tempor incididunt ut labore et dolore magna aliqua. \n  &lt;br \/&gt;&lt;br \/&gt;\n  Ut enim ad minim veniam, quis nostrud exercitation ullamco \n  laboris nisi ut aliquip ex ea commodo consequat.\n  &lt;br \/&gt; &lt;br \/&gt;\n  Duis aute irure dolor in reprehenderit in voluptate velit \n  esse cillum dolore eu fugiat nulla pariatur.\n&lt;\/div&gt;\n<\/pre>\n<p>We can employ the <code>.contents()<\/code> method to help convert this blob of text into three well-formed paragraphs:<\/p>\n<pre>\n$('.container').contents().filter(function() {\n  return this.nodeType == 3;\n})\n  .wrap('&lt;p&gt;&lt;\/p&gt;')\n.end()\n.filter('br')\n  .remove();\n<\/pre>\n<p>This code first retrieves the contents  of <code>&lt;div class=\"container\"&gt;<\/code> and then filters it for text nodes, which are wrapped in paragraph tags. This is accomplished by testing the <a href=\"https:\/\/developer.mozilla.org\/en\/nodeType\"><code>.nodeType<\/code> property<\/a> of the element. This DOM property holds a numeric code indicating the node's type; text nodes use the code 3. The contents are again filtered, this time for <code>&lt;br \/&gt;<\/code> elements, and these elements are removed.<\/p>\n","categories":["Traversing > Miscellaneous Traversing","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/context\/","name":"context","title":".context","type":"property","signatures":[{"added":"1.3"}],"desc":"The DOM node context originally passed to <code>jQuery()<\/code>; if none was passed then context will likely be the document.","longdesc":"<p>The <code>.live()<\/code> method for binding event handlers uses this property to determine the root element to use for its event delegation needs.<\/p><p>\nThe value of this property is typically equal to <code>document<\/code>, as this is the default context for jQuery objects if none is supplied. The context may differ if, for example, the object was created by searching within an <code>&lt;iframe&gt;<\/code> or XML document.<\/p>\n<p>Note that the context property may only apply to the elements originally selected by <code>jQuery()<\/code>, as it is possible for the user to add elements to the collection via methods such as <code>.add()<\/code> and these may have a different context.<\/p>","categories":["Internals","Properties > Properties of jQuery Object Instances","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/css\/","name":"css","title":".css()","type":"method","signatures":[{"added":"1.0","params":[{"name":"propertyName","type":"String","optional":"","desc":"A CSS property."}]}],"desc":"Get the value of a style property for the first element in the set of matched elements.","longdesc":"<p>The <code>.css()<\/code> method is a convenient way to get a style property from the first matched element, especially in light of the different ways browsers access most of those properties (the <code>getComputedStyle()<\/code> method in standards-based browsers versus the <code>currentStyle<\/code> and <code>runtimeStyle<\/code> properties in Internet Explorer) and the different terms browsers use for certain properties. For example, Internet Explorer's DOM implementation refers to the <code>float<\/code> property as <code>styleFloat<\/code>, while W3C standards-compliant browsers refer to it as <code>cssFloat<\/code>. The <code>.css()<\/code> method accounts for such differences, producing the same result no matter which term we use. For example, an element that is floated left will return the string <code>left<\/code> for each of the following three lines:<\/p>\n\t\t\t\t<ol>\n\t\t\t\t\t<li><code>$('div.left').css('float');<\/code><\/li>\n\t\t\t\t\t<li><code>$('div.left').css('cssFloat');<\/code><\/li>\n\t\t\t\t\t<li><code>$('div.left').css('styleFloat');<\/code><\/li>\n\t\t\t\t<\/ol>\n\t\t\t\t<p>Also, jQuery can equally interpret the CSS and DOM formatting of multiple-word properties. For example, jQuery understands and returns the correct value for both <code>.css('background-color')<\/code> and <code>.css('backgroundColor')<\/code>. Different browsers may return CSS color values that are logically but not textually equal, e.g., #FFF, #ffffff, and rgb(255,255,255).<\/p>\n\t\t\t\t<p>Shorthand CSS properties (e.g. margin, background, border) are not supported. For example, if you want to retrieve the rendered margin, use: <code>$(elem).css('marginTop')<\/code> and <code>$(elem).css('marginRight')<\/code>, and so on.<\/p>","categories":["CSS","Manipulation > Style Properties","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/css\/","name":"css","title":".css()","type":"method","signatures":[{"added":"1.0","params":[{"name":"propertyName","type":"String","optional":"","desc":"A CSS property name."},{"name":"value","type":"String, Number","optional":"","desc":"A value to set for the property."}]},{"added":"1.4","params":[{"name":"propertyName","type":"String","optional":"","desc":"A CSS property name."},{"name":"function(index, value)","type":"Function","optional":"","desc":"A function returning the value to set. <code>this<\/code> is the current element. Receives the index position of the element in the set and the old value as arguments."}]},{"added":"1.0","params":[{"name":"map","type":"Map","optional":"","desc":"A map of property-value pairs to set."}]}],"desc":"Set one or more CSS properties for the  set of matched elements.","longdesc":"<p>As with the <code>.prop()<\/code> method, the <code>.css()<\/code> method makes setting properties of elements quick and easy. This method can take either a property name and value as separate parameters, or a single map of key-value pairs (JavaScript object notation).<\/p>\n      <p>Also, jQuery can equally interpret the CSS and DOM formatting of multiple-word properties. For example, jQuery understands and returns the correct value for both <code>.css({'background-color': '#ffe', 'border-left': '5px solid #ccc'})<\/code> and <code>.css({backgroundColor: '#ffe', borderLeft: '5px solid #ccc'})<\/code>. Notice that with the DOM notation, quotation marks around the property names are optional, but with CSS notation they're required due to the hyphen in the name.<\/p>\n      \n      <p>When using <code>.css()<\/code> as a setter, jQuery modifies the element's <code>style<\/code> property. For example,  <code>$('#mydiv').css('color', 'green')<\/code> is equivalent to <code>document.getElementById('mydiv').style.color = 'green'<\/code>. Setting the value of a style property to an empty string \u2014 e.g. <code>$('#mydiv').css('color', '')<\/code> \u2014 removes that property from an element if it has already been directly applied, whether in the HTML style attribute, through jQuery's <code>.css()<\/code> method, or through direct DOM manipulation of the <code>style<\/code> property. It does not, however, remove a style that has been applied with a CSS rule in a stylesheet or <code>&lt;style&gt;<\/code> element.<\/p>\n\n     <p>As of jQuery 1.6, <code>.css()<\/code> accepts relative values similar to <code>.animate()<\/code>. Relative values are a string starting with <code>+=<\/code> or <code>-=<\/code> to increment or decrement the current value. For example, if an element's padding-left was 10px, <code>.css( \"padding-left\", \"+=15\" )<\/code> would result in a total padding-left of 25px.<\/p>\n\n      <p>As of jQuery 1.4, <code>.css()<\/code> allows us to pass a function as the property value:<\/p>\n<pre>$('div.example').css('width', function(index) {\n  return index * 50;\n});<\/pre>\n  <p>This example sets the widths of the matched elements to incrementally larger values.<\/p>\n  <p><strong>Note: <\/strong>If nothing is returned in the setter function (ie. <code>function(index, style){})<\/code>, or if <code>undefined<\/code> is returned, the current value is not changed. This is useful for selectively setting values only when certain criteria are met.<\/p>\n","categories":["CSS","Manipulation > Style Properties","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/data\/","name":"data","title":".data()","type":"method","signatures":[{"added":"1.2.3","params":[{"name":"key","type":"String","optional":"","desc":"A string naming the piece of data to set."},{"name":"value","type":"Object","optional":"","desc":"The new data value; it can be any Javascript type including Array or Object."}]},{"added":"1.4.3","params":[{"name":"obj","type":"Object","optional":"","desc":"An object of key-value pairs of data to update."}]}],"desc":"Store arbitrary data associated with the matched elements.","longdesc":"<p>The <code>.data()<\/code> method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore from memory leaks.<\/p>\n<p> We can set several distinct values for a single element and retrieve them later:<\/p>\n<pre>\n$('body').data('foo', 52);\n$('body').data('bar', { myType: 'test', count: 40 });\n\n$('body').data('foo'); \/\/ 52\n$('body').data(); \/\/ {foo: 52, bar: { myType: 'test', count: 40 }}\n<\/pre>\n<p>In jQuery 1.4.3 setting an element's data object with <code>.data(obj)<\/code> extends the data previously stored with that element. jQuery itself uses the <code>.data()<\/code> method to save information under the names 'events' and 'handle', and also reserves any data name starting with an underscore ('_') for internal use.<\/p>\n<p>Prior to jQuery 1.4.3 (starting in jQuery 1.4) the .data() method completely replaced all data, instead of just extending the data object. If you are using third-party plugins it may not be advisable to completely replace the element's data object, since plugins may have also set data.<\/p>\n<p>Due to the way browsers interact with plugins and external code, the <code>.data()<\/code> method cannot be used on <code>&lt;object&gt;<\/code> (unless it's a Flash plugin), <code>&lt;applet&gt;<\/code> or <code>&lt;embed&gt;<\/code> elements.<\/p>\n","categories":["Data","Miscellaneous > Data Storage","Version > Version 1.2.3","Version > Version 1.4","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/data\/","name":"data","title":".data()","type":"method","signatures":[{"added":"1.2.3","params":[{"name":"key","type":"String","optional":"","desc":"Name of the data stored."}]},{"added":"1.4"}],"desc":"Returns value at named data store for the first element in the jQuery collection, as set by data(name, value).","longdesc":"\n<p>The <code>.data()<\/code> method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore from memory leaks. We can retrieve several distinct values for a single element one at a time, or as a set:<\/p>\n<pre>\nalert($('body').data('foo'));\nalert($('body').data());\n<\/pre>\n<p>The above lines alert the data values that were set on the <code>body<\/code> element. If no data at all was set on that element, <code>undefined<\/code> is returned.<\/p>\n<pre>\nalert( $(\"body\").data(\"foo\")); \/\/undefined\n$(\"body\").data(\"bar\", \"foobar\");\nalert( $(\"body\").data(\"bar\")); \/\/foobar\n<\/pre>\n\n<h4 id=\"data-html5\"><a href=\"#data-html5\">HTML5 data-* Attributes<\/a><\/h4>\n<p>As of jQuery 1.4.3 <a href=\"http:\/\/ejohn.org\/blog\/html-5-data-attributes\/\">HTML 5 data- attributes<\/a> will be automatically pulled in to jQuery's data object. The treatment of attributes with embedded dashes was changed in jQuery 1.6 to conform to the <a href=\"http:\/\/www.w3.org\/TR\/html5\/elements.html#embedding-custom-non-visible-data-with-the-data-attributes\">W3C HTML5 specification<\/a>.<\/p>\n\n<p>For example, given the following HTML:<\/p>\n\n<pre>&lt;div data-role=\"page\" data-last-value=\"43\" data-hidden=\"true\" data-options='{\"name\":\"John\"}'&gt;&lt;\/div&gt;<\/pre>\n\n<p>All of the following jQuery code will work.<\/p>\n\n<pre>$(\"div\").data(\"role\") === \"page\";\n$(\"div\").data(\"lastValue\") === 43;\n$(\"div\").data(\"hidden\") === true;\n$(\"div\").data(\"options\").name === \"John\";<\/pre>\n\n<p>Every attempt is made to convert the string to a JavaScript value (this includes booleans, numbers, objects, arrays, and null) otherwise it is left as a string. To retrieve the value's attribute as a string without any attempt to convert it, use the <code><a href=\"\/attr\/\">attr()<\/a><\/code> method. When the data attribute is an object (starts with '{') or array (starts with '[') then <code>jQuery.parseJSON<\/code> is used to parse the string; it must follow <a href=\"http:\/\/en.wikipedia.org\/wiki\/JSON#Data_types.2C_syntax_and_example\">valid JSON syntax<\/a> <em>including quoted property names<\/em>. The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery).<\/p>\n<p>Calling <code>.data()<\/code> with no parameters retrieves all of the values as a JavaScript object. This object can be safely cached in a variable as long as a new object is not set with <code>.data(obj)<\/code>. Using the object directly to get or set values is faster than making individual calls to <code>.data()<\/code> to get or set each value:<\/p>\n<pre>\nvar mydata = $(\"#mydiv\").data();\nif ( mydata.count &lt; 9 ) {\n    mydata.count = 43;\n    mydata.status = \"embiggened\";\n}\n<\/pre>\n","categories":["Data","Miscellaneous > Data Storage","Version > Version 1.2.3","Version > Version 1.4","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/dblclick\/","name":"dblclick","title":".dblclick()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"dblclick\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('dblclick', handler)<\/code> in the first two variations, and <code>.trigger('dblclick')<\/code> in the third.\nThe <code>dblclick<\/code> event is sent to an element when the element is double-clicked. Any HTML element can receive this event.\nFor example, consider the HTML:<\/p>\n<pre>&lt;div id=\"target\"&gt;\n  Double-click here\n&lt;\/div&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;<\/pre>\n \n<p class=\"image\"><img src=\"\/images\/0042_05_04.png\" alt=\"\"\/>\n<\/p>\n<p>The event handler can be bound to any <code>&lt;div&gt;<\/code>:<\/p>\n<pre>$('#target').dblclick(function() {\n  alert('Handler for .dblclick() called.');\n});<\/pre>\n<p>Now double-clicking on this element displays the alert:<\/p>\n<p><span class=\"output\">Handler for .dblclick() called.<\/span><\/p>\n<p>To trigger the event manually, apply <code>.dblclick()<\/code> without an argument:<\/p>\n<pre>$('#other').click(function() {\n  $('#target').dblclick();\n});<\/pre>\n<p>After this code executes, (single) clicks on <span class=\"output\">Trigger the handler<\/span> will also alert the message.<\/p>\n<p>The <code>dblclick<\/code> event is only triggered after this exact series of events:<\/p>\n<ul>\n<li>The mouse button is depressed while the pointer is inside the element.<\/li>\n<li>The mouse button is released while the pointer is inside the element.<\/li>\n<li>The mouse button is depressed again while the pointer is inside the element, within a time window that is system-dependent.<\/li>\n<li>The mouse button is released while the pointer is inside the element.<\/li>\n<\/ul>\n<p>It is inadvisable to bind handlers to both the <code>click<\/code> and <code>dblclick<\/code> events for the same element. The sequence of events triggered varies from browser to browser, with some receiving two <code>click<\/code> events before the <code>dblclick<\/code> and others only one. Double-click sensitivity (maximum time between clicks that is detected as a double click) can vary by operating system and browser, and is often user-configurable.\n<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.always\/","name":"deferred.always","title":"deferred.always()","type":"","signatures":[{"added":"1.6","params":[{"name":"alwaysCallbacks","type":"Function","optional":"","desc":"\n        A function, or array of functions, that is called when the Deferred is resolved or rejected.\n      "},{"name":"alwaysCallbacks","type":"Function","optional":"optional","desc":"\n        Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.\n      "}]}],"desc":" Add handlers to be called when the Deferred object is either resolved or rejected. ","longdesc":" <p>The argument can be either a single function or an array of functions. When the Deferred is resolved or rejected, the <code>alwaysCallbacks<\/code> are called. Since <code>deferred.always()<\/code> returns the Deferred object, other methods of the Deferred object can be chained to this one, including additional <code>.always()<\/code> methods. When the Deferred is resolved or rejected, callbacks are executed in the order they were added, using the arguments provided to the <a href=\"\/deferred.resolve\/\"><code>resolve<\/code><\/a>, <a href=\"\/deferred.reject\/\"><code>reject<\/code><\/a>, <a href=\"\/deferred.resolveWith\/\"><code>resolveWith<\/code><\/a> or <a href=\"\/deferred.rejectWith\/\"><code>rejectWith<\/code><\/a> method calls. For more information, see the documentation for <a href=\"\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>  ","categories":["Deferred Object","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.done\/","name":"deferred.done","title":"deferred.done()","type":"","signatures":[{"added":"1.5","params":[{"name":"doneCallbacks","type":"Function","optional":"","desc":"\n             A function, or array of functions, that are called when the Deferred is resolved.\n           "},{"name":"doneCallbacks","type":"Function","optional":"optional","desc":"\n             Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.\n           "}]}],"desc":" Add handlers to be called when the Deferred object is resolved. ","longdesc":" <p>The <code>deferred.done()<\/code> method accepts one or more arguments, all of which can be either a single function or an array of functions. When the Deferred is resolved, the doneCallbacks are called. Callbacks are executed in the order they were added. Since <code>deferred.done()<\/code> returns the deferred object, other methods of the deferred object can be chained to this one, including additional <code>.done()<\/code> methods. When the Deferred is resolved, doneCallbacks are executed using the arguments provided to the <a href=\"\/deferred.resolve\/\"><code>resolve<\/code><\/a> or <a href=\"\/deferred.resolveWith\/\"><code>resolveWith<\/code><\/a> method call in the order they were added. For more information, see the documentation for <a href=\"\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>  ","categories":["Deferred Object","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.fail\/","name":"deferred.fail","title":"deferred.fail()","type":"","signatures":[{"added":"1.5","params":[{"name":"failCallbacks","type":"Function","optional":"","desc":"\n             A function, or array of functions, that are called when the Deferred is rejected.\n           "},{"name":"failCallbacks","type":"Function","optional":"optional","desc":"\n             Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.\n           "}]}],"desc":" Add handlers to be called when the Deferred object is rejected. ","longdesc":" <p>The <code>deferred.fail()<\/code> method accepts one or more arguments, all of which can be either a single function or an array of functions. When the Deferred is rejected, the failCallbacks are called. Callbacks are executed in the order they were added. Since <code>deferred.fail()<\/code> returns the deferred object, other methods of the deferred object can be chained to this one, including additional <code>deferred.fail()<\/code> methods. The failCallbacks are executed using the arguments provided to the <a href=\"deferred.reject\"><code>deferred.reject()<\/code><\/a> or <a href=\"deferred.rejectWith\"><code>deferred.rejectWith()<\/code><\/a> method call in the order they were added. For more information, see the documentation for <a href=\"\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>  ","categories":["Deferred Object","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.isRejected\/","name":"deferred.isRejected","title":"deferred.isRejected()","type":"","signatures":[{"added":"1.5"}],"desc":" Determine whether a Deferred object has been rejected. ","longdesc":" \n<p>As of jQuery 1.7 this API has been deprecated; please use <a href=\"http:\/\/api.jquery.com\/deferred.state\"><code>deferred.state()<\/code><\/a> instead.<\/p>\n<p>Returns <code>true<\/code> if the Deferred object is in the rejected state, meaning that either <a href=\"http:\/\/api.jquery.com\/deferred.reject\/\"><code>deferred.reject()<\/code><\/a> or <a href=\"http:\/\/api.jquery.com\/deferred.rejectWith\/\"><code>deferred.rejectWith()<\/code><\/a> has been called for the object and the failCallbacks have been called (or are in the process of being called).<\/p>\n<p>Note that a Deferred object can be in one of three states: pending, resolved, or rejected; use <a href=\"http:\/\/api.jquery.com\/deferred.isResolved\/\"><code>deferred.isResolved()<\/code><\/a> to determine whether the Deferred object is in the resolved state. These methods are primarily useful for debugging, for example to determine whether a Deferred has already been resolved even though you are inside code that intended to reject it.<\/p>  ","categories":["Deferred Object","Deprecated","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.isResolved\/","name":"deferred.isResolved","title":"deferred.isResolved()","type":"","signatures":[{"added":"1.5"}],"desc":" Determine whether a Deferred object has been resolved. ","longdesc":" \n<p>As of jQuery 1.7 this API has been deprecated; please use <a href=\"http:\/\/api.jquery.com\/deferred.state\"><code>deferred.state()<\/code><\/a> instead.<\/p>\n<p>Returns <code>true<\/code> if the Deferred object is in the resolved state, meaning that either <a href=\"http:\/\/api.jquery.com\/deferred.resolve\/\"><code>deferred.resolve()<\/code><\/a> or <a href=\"http:\/\/api.jquery.com\/deferred.resolveWith\/\"><code>deferred.resolveWith()<\/code><\/a> has been called for the object and the doneCallbacks have been called (or are in the process of being called).<\/p>\n<p>Note that a Deferred object can be in one of three states: pending, resolved, or rejected; use <a href=\"http:\/\/api.jquery.com\/deferred.isRejected\/\"><code>deferred.isRejected()<\/code><\/a> to determine whether the Deferred object is in the rejected state. These methods are primarily useful for debugging, for example to determine whether a Deferred has already been resolved even though you are inside code that intended to reject it.<\/p>  ","categories":["Deferred Object","Deprecated","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.notify\/","name":"deferred.notify","title":"deferred.notify()","type":"","signatures":[{"added":"1.7","params":[{"name":"args","type":"Object","optional":"","desc":"\n             Optional arguments that are passed to the progressCallbacks.\n           "}]}],"desc":" Call the progressCallbacks on a Deferred object with the given <code>args<\/code>. ","longdesc":"\n<p>Normally, only the creator of a Deferred should call this method; you can prevent other code from changing the Deferred's state or reporting status by returning a restricted Promise object through deferred.promise().<\/p>\n<p>When <code>deferred.notify<\/code> is called, any progressCallbacks added by <a href=\"http:\/\/api.jquery.com\/deferred.then\/\"><code>deferred.then<\/code><\/a> or <a href=\"http:\/\/api.jquery.com\/deferred.progress\/\"><code>deferred.progress<\/code><\/a> are called. Callbacks are executed in the order they were added. Each callback is passed the <code>args<\/code> from the <code>.notify()<\/code>. Any calls to <code>.notify()<\/code> after a Deferred is resolved or rejected (or any progressCallbacks added after that) are ignored. For more information, see the documentation for <a href=\"http:\/\/api.jquery.com\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>\n\n","categories":["Deferred Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.notifyWith\/","name":"deferred.notifyWith","title":"deferred.notifyWith()","type":"","signatures":[{"added":"1.7","params":[{"name":"context","type":"Object","optional":"","desc":"\n             Context passed to the progressCallbacks as the <code>this<\/code> object.\n           "},{"name":"args","type":"Object","optional":"optional","desc":"\n             Optional arguments that are passed to the progressCallbacks.\n           "}]}],"desc":" Call the progressCallbacks on a Deferred object with the given context and <code>args<\/code>. ","longdesc":"\n<p>Normally, only the creator of a Deferred should call this method; you can prevent other code from changing the Deferred's state or reporting status by returning a restricted Promise object through deferred.promise().<\/p>\n<p>When <code>deferred.notifyWith<\/code> is called, any progressCallbacks added by <a href=\"http:\/\/api.jquery.com\/deferred.then\/\"><code>deferred.then<\/code><\/a> or <a href=\"http:\/\/api.jquery.com\/deferred.progress\/\"><code>deferred.progress<\/code><\/a> are called. Callbacks are executed in the order they were added. Each callback is passed the <code>args<\/code> from the <code>.notifyWith()<\/code>. Any calls to <code>.notifyWith()<\/code> after a Deferred is resolved or rejected (or any progressCallbacks added after that) are ignored. For more information, see the documentation for <a href=\"http:\/\/api.jquery.com\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>\n\n","categories":["Deferred Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.pipe\/","name":"deferred.pipe","title":"deferred.pipe()","type":"","signatures":[{"added":"1.6","params":[{"name":"doneFilter","type":"Function","optional":"optional","desc":"\n        An optional function that is called when the Deferred is resolved.\n      "},{"name":"failFilter","type":"Function","optional":"optional","desc":"\n        An optional function that is called when the Deferred is rejected.\n      "}]},{"added":"1.7","params":[{"name":"doneFilter","type":"Function","optional":"optional","desc":"\n        An optional function that is called when the Deferred is resolved.\n      "},{"name":"failFilter","type":"Function","optional":"optional","desc":"\n        An optional function that is called when the Deferred is rejected.\n      "},{"name":"progressFilter","type":"Function","optional":"optional","desc":"\n        An optional function that is called when progress notifications are sent to the Deferred.\n      "}]}],"desc":" Utility method to filter and\/or chain Deferreds.  ","longdesc":"\n    <p>The <code>deferred.pipe()<\/code> method returns a new promise that filters the status and values of a deferred through a function.  The <code>doneFilter<\/code> and <code>failFilter<\/code> functions filter the original deferred's resolved \/ rejected status and values. <strong>As of jQuery 1.7<\/strong>, the method also accepts a <code>progressFilter<\/code> function to filter any calls to the original deferred's <code>notify<\/code> or <code>notifyWith<\/code> methods. These filter functions can return a new value to be passed along to the piped promise's <code>done()<\/code> or <code>fail()<\/code> callbacks, or they can return another observable object (Deferred, Promise, etc) which will pass its resolved \/ rejected status and values to the piped promise's callbacks. If the filter function used is <code>null<\/code>, or not specified, the piped promise will be resolved or rejected with the same values as the original.<\/p>\n","categories":["Deferred Object","Version > Version 1.6","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.progress\/","name":"deferred.progress","title":"deferred.progress()","type":"","signatures":[{"added":"1.7","params":[{"name":"progressCallbacks","type":"Function","optional":"","desc":"\n        A function, or array of functions, that is called when the Deferred generates progress notifications.\n      "}]}],"desc":" Add handlers to be called when the Deferred object generates progress notifications.","longdesc":" <p>The argument can be either a single function or an array of functions. When the Deferred generates progress notifications by calling <code>notify<\/code> or <code>notifyWith<\/code>, the <code>progressCallbacks<\/code> are called. Since <code>deferred.progress()<\/code> returns the Deferred object, other methods of the Deferred object can be chained to this one. When the Deferred is resolved or rejected, progress callbacks will no longer be called. For more information, see the documentation for <a href=\"\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>  ","categories":["Deferred Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.promise\/","name":"deferred.promise","title":"deferred.promise()","type":"","signatures":[{"added":"1.5","params":[{"name":"target","type":"Object","optional":"optional","desc":"Object onto which the promise methods have to be attached"}]}],"desc":" Return a Deferred's Promise object. ","longdesc":" <p>The <code>deferred.promise()<\/code> method allows an asynchronous function to prevent other code from interfering with the progress or status of its internal request. The Promise exposes only the Deferred methods needed to attach additional handlers or determine the state (<code>then<\/code>, <code>done<\/code>, <code>fail<\/code>, <code>always<\/code>, <code>pipe<\/code>, <code>progress<\/code>, and <code>state<\/code>), but not ones that change the state (<code>resolve<\/code>, <code>reject<\/code>, <code>notify<\/code>, <code>resolveWith<\/code>, <code>rejectWith<\/code>, and <code>notifyWith<\/code>).<\/p>\n\n<p>If <code>target<\/code> is provided, <code>deferred.promise()<\/code> will attach the methods onto it and then return this object rather than create a new one. This can be useful to attach the Promise behavior to an object that already exists.<\/p>\n\n<p>If you are creating a Deferred, keep a reference to the Deferred so that it can be resolved or rejected at some point. Return <em>only<\/em> the Promise object via <code>deferred.promise()<\/code> so other code can register callbacks or inspect the current state.<\/p>\n<p>For more information, see the documentation for <a href=\"\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>  \n","categories":["Deferred Object","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.reject\/","name":"deferred.reject","title":"deferred.reject()","type":"","signatures":[{"added":"1.5","params":[{"name":"args","type":"Object","optional":"","desc":"\n             Optional arguments that are passed to the failCallbacks.\n           "}]}],"desc":" Reject a Deferred object and call any failCallbacks with the given <code>args<\/code>. ","longdesc":" <p>Normally, only the creator of a Deferred should call this method; you can prevent other code from changing the Deferred's state by returning a restricted Promise object through <a href=\"http:\/\/api.jquery.com\/deferred.promise\/\"><code>deferred.promise()<\/code><\/a>.<\/p>\n<p>When the Deferred is rejected, any failCallbacks added by <a href=\"http:\/\/api.jquery.com\/deferred.then\/\"><code>deferred.then<\/code><\/a> or <a href=\"http:\/\/api.jquery.com\/deferred.fail\/\"><code>deferred.fail<\/code><\/a> are called. Callbacks are executed in the order they were added. Each callback is passed the <code>args<\/code> from the <code>deferred.reject()<\/code> call. Any failCallbacks added after the Deferred enters the rejected state are executed immediately when they are added, using the arguments that were passed to the <code>.reject()<\/code> call. For more information, see the documentation for <a href=\"http:\/\/api.jquery.com\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>  ","categories":["Deferred Object","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.rejectWith\/","name":"deferred.rejectWith","title":"deferred.rejectWith()","type":"","signatures":[{"added":"1.5","params":[{"name":"context","type":"Object","optional":"","desc":"\n             Context passed to the failCallbacks as the <code>this<\/code> object.\n           "},{"name":"args","type":"Array","optional":"optional","desc":"\n             An optional array of arguments that are passed to the failCallbacks.\n           "}]}],"desc":" Reject a Deferred object and call any failCallbacks with the given <code>context<\/code> and <code>args<\/code>. ","longdesc":" <p>Normally, only the creator of a Deferred should call this method; you can prevent other code from changing the Deferred's state by returning a restricted Promise object through <a href=\"http:\/\/api.jquery.com\/deferred.promise\/\"><code>deferred.promise()<\/code><\/a>.<\/p>\n<p>When the Deferred is rejected, any failCallbacks added by <a href=\"\/deferred.then\/\"><code>deferred.then<\/code><\/a> or <a href=\"\/deferred.fail\/\"><code>deferred.fail<\/code><\/a> are called. Callbacks are executed in the order they were added. Each callback is passed the <code>args<\/code> from the <code>deferred.reject()<\/code> call. Any failCallbacks added after the Deferred enters the rejected state are executed immediately when they are added, using the arguments that were passed to the <code>.reject()<\/code> call. For more information, see the documentation for <a href=\"\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>  ","categories":["Deferred Object","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.resolve\/","name":"deferred.resolve","title":"deferred.resolve()","type":"","signatures":[{"added":"1.5","params":[{"name":"args","type":"Object","optional":"","desc":"\n             Optional arguments that are passed to the doneCallbacks.\n           "}]}],"desc":" Resolve a Deferred object and call any doneCallbacks with the given <code>args<\/code>. ","longdesc":" <p>When the Deferred is resolved, any doneCallbacks added by <a href=\"\/deferred.then\/\"><code>deferred.then<\/code><\/a> or <a href=\"\/deferred.done\/\"><code>deferred.done<\/code><\/a> are called. Callbacks are executed in the order they were added. Each callback is passed the <code>args<\/code> from the <code>.resolve()<\/code>. Any doneCallbacks added after the Deferred enters the resolved state are executed immediately when they are added, using the arguments that were passed to the <code>.resolve()<\/code> call. For more information, see the documentation for <a href=\"\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>  ","categories":["Deferred Object","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.resolveWith\/","name":"deferred.resolveWith","title":"deferred.resolveWith()","type":"","signatures":[{"added":"1.5","params":[{"name":"context","type":"Object","optional":"","desc":"\n             Context passed to the doneCallbacks as the <code>this<\/code> object.\n           "},{"name":"args","type":"Array","optional":"optional","desc":"\n             An optional array of arguments that are passed to the doneCallbacks.\n           "}]}],"desc":" Resolve a Deferred object and call any doneCallbacks with the given <code>context<\/code> and <code>args<\/code>. ","longdesc":" <p>Normally, only the creator of a Deferred should call this method; you can prevent other code from changing the Deferred's state by returning a restricted Promise object through <a href=\"http:\/\/api.jquery.com\/deferred.promise\/\"><code>deferred.promise()<\/code><\/a>.<\/p>\n<p>When the Deferred is resolved, any doneCallbacks added by <a href=\"\/deferred.then\/\"><code>deferred.then<\/code><\/a> or <a href=\"\/deferred.done\/\"><code>deferred.done<\/code><\/a> are called. Callbacks are executed in the order they were added. Each callback is passed the <code>args<\/code> from the <code>.resolve()<\/code>. Any doneCallbacks added after the Deferred enters the resolved state are executed immediately when they are added, using the arguments that were passed to the <code>.resolve()<\/code> call. For more information, see the documentation for <a href=\"\/category\/deferred-object\/\">Deferred object<\/a>.<\/p>  ","categories":["Deferred Object","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.state\/","name":"deferred.state","title":"deferred.state()","type":"","signatures":[{"added":"1.7"}],"desc":"Determine the current state of a Deferred object. ","longdesc":"\n    <p>The deferred.state() method returns a string representing the current state of the Deferred object. The Deferred object can be in one of three states:<\/p>\n    <ul>\n      <li><strong>\"pending\"<\/strong>: The Deferred object is not yet in a completed state (neither \"rejected\" nor \"resolved\").<\/li>\n      <li><strong>\"resolved\"<\/strong>: The Deferred object is in the resolved state, meaning that either <a href=\"http:\/\/api.jquery.com\/deferred.resolve\/\"><code>deferred.resolve()<\/code><\/a> or <a href=\"http:\/\/api.jquery.com\/deferred.resolveWith\/\"><code>deferred.resolveWith()<\/code><\/a> has been called for the object and the doneCallbacks have been called (or are in the process of being called). <\/li>\n      <li><strong>\"rejected\"<\/strong>: The Deferred object is in the rejected state, meaning that either <a href=\"http:\/\/api.jquery.com\/deferred.reject\/\"><code>deferred.reject()<\/code><\/a> or <a href=\"http:\/\/api.jquery.com\/deferred.rejectWith\/\"><code>deferred.rejectWith()<\/code><\/a> has been called for the object and the failCallbacks have been called (or are in the process of being called).<\/li>\n    <\/ul>\n    <p>This method is primarily useful for debugging to determine, for example, whether a Deferred has already been resolved even though you are inside code that intended to reject it.<\/p>\n  ","categories":["Deferred Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/deferred.then\/","name":"deferred.then","title":"deferred.then()","type":"","signatures":[{"added":"1.5","params":[{"name":"doneCallbacks","type":"Function","optional":"","desc":"\n             A function, or array of functions, called when the Deferred is resolved.\n           "},{"name":"failCallbacks","type":"Function","optional":"","desc":"\n             A function, or array of functions, called when the Deferred is rejected.\n           "}]},{"added":"1.7","params":[{"name":"doneCallbacks","type":"Function","optional":"","desc":"\n             A function, or array of functions, called when the Deferred is resolved.\n           "},{"name":"failCallbacks","type":"Function","optional":"","desc":"\n             A function, or array of functions, called when the Deferred is rejected.\n           "},{"name":"progressCallbacks","type":"Function","optional":"optional","desc":"\n             A function, or array of functions, called when the Deferred notifies progress.\n           "}]}],"desc":" Add handlers to be called when the Deferred object is resolved or rejected. ","longdesc":" <p>All three arguments (including progressCallbacks, as of jQuery 1.7) can be either a single function or an array of functions. The arguments can also be <code>null<\/code> if no callback of that type is desired. Alternatively, use <code>.done()<\/code>, <code>.fail()<\/code> or <code>.progress()<\/code> to set only one type of callback. <\/p>\n<p>When the Deferred is resolved, the doneCallbacks are called. If the Deferred is instead rejected, the failCallbacks are called. As of jQuery 1.7, the <code>deferred.notify()<\/code> or <code>deferred.notifyWith()<\/code> methods can be called to invoke the progressCallbacks as many times as desired before the Deferred is resolved or rejected.<\/p>\n<p>Callbacks are executed in the order they were added. Since <code>deferred.then<\/code> returns the deferred object, other methods of the deferred object can be chained to this one, including additional <code>.then()<\/code> methods. For more information, see the documentation for <a href=\"http:\/\/api.jquery.com\/category\/deferred-object\/\">Deferred object<\/a>.<\/p> ","categories":["Deferred Object","Version > Version 1.5","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/delay\/","name":"delay","title":".delay()","type":"method","signatures":[{"added":"1.4","params":[{"name":"duration","type":"Integer","optional":"","desc":"An integer indicating the number of milliseconds to delay execution of the next item in the queue."},{"name":"queueName","type":"String","optional":"optional","desc":"A string containing the name of the queue. Defaults to <code>fx<\/code>, the standard effects queue."}]}],"desc":"Set a timer to delay execution of subsequent items in the queue.","longdesc":"<p>Added to jQuery in version 1.4, the <code>.delay()<\/code> method allows us to delay the execution of functions that follow it in the queue. It can be used with the standard effects queue or with a custom queue. Only subsequent events in a queue are delayed; for example this will <em>not<\/em> delay the no-arguments forms of <code>.show()<\/code> or <code>.hide()<\/code>  which do not use the effects queue.<\/p>\n<p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of 200 and 600 milliseconds, respectively.<\/p>\n<p>Using the standard effects queue, we can, for example, set an 800-millisecond delay between the <code>.slideUp()<\/code> and <code>.fadeIn()<\/code> of <code>&lt;div id=\"foo\"&gt;<\/code>:<\/p>\n<pre>$('#foo').slideUp(300).delay(800).fadeIn(400);<\/pre>\n<p>When this statement is executed, the element slides up for 300 milliseconds and then pauses for 800 milliseconds before fading in for 400 milliseconds.<\/p>\n<blockquote><p><strong>The <code>.delay()<\/code> method is best for delaying between queued jQuery effects. Because it is limited\u2014it doesn't, for example, offer a way to cancel the delay\u2014<code>.delay()<\/code> is not a replacement for JavaScript's native <a href=\"https:\/\/developer.mozilla.org\/en\/DOM\/window.setTimeout\">setTimeout<\/a> function, which may be more appropriate for certain use cases.<\/strong><\/p><\/blockquote>\n","categories":["Effects > Custom","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/delegate\/","name":"delegate","title":".delegate()","type":"method","signatures":[{"added":"1.4.2","params":[{"name":"selector","type":"String","optional":"","desc":"A selector to filter the elements that trigger the event."},{"name":"eventType","type":"String","optional":"","desc":"A string containing one or more space-separated JavaScript event types, such as \"click\" or \"keydown,\" or custom event names."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute at the time the event is triggered."}]},{"added":"1.4.2","params":[{"name":"selector","type":"String","optional":"","desc":"A selector to filter the elements that trigger the event."},{"name":"eventType","type":"String","optional":"","desc":"A string containing one or more space-separated JavaScript event types, such as \"click\" or \"keydown,\" or custom event names."},{"name":"eventData","type":"Object","optional":"","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute at the time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"selector","type":"String","optional":"","desc":"A selector to filter the elements that trigger the event."},{"name":"events","type":"Map","optional":"","desc":"A map of one or more event types and functions to execute for them."}]}],"desc":"Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.","longdesc":"\n  <p>As of jQuery 1.7, <code>.delegate()<\/code> has been superseded by the <a href=\"http:\/\/api.jquery.com\/on\">.on()<\/a> method. For earlier versions, however, it remains the most effective means to use event delegation. More information on event binding and delegation is in the <a href=\"http:\/\/api.jquery.com\/on\">.on()<\/a> method. In general, these are the equivalent templates for the two methods:<\/p>\n <pre>\n$(elements).delegate(<em>selector<\/em>, <em>events<\/em>, <em>data<\/em>, <em>handler<\/em>);  \/\/ jQuery 1.4.3+\n$(elements).on(<em>events<\/em>, <em>selector<\/em>, <em>data<\/em>, <em>handler<\/em>);        \/\/ jQuery 1.7+\n <\/pre>\n <p>For example, the following <code>.delegate()<\/code> code:<\/p>\n\n<pre>$(\"table\").delegate(\"td\", \"click\", function() {\n  $(this).toggleClass(\"chosen\");\n});<\/pre>\n\n<p>is equivalent to the following code written using <code>.on()<\/code>:<\/p>\n\n<pre>$(\"table\").on(\"click\", \"td\", function() {\n  $(this).toggleClass(\"chosen\");\n});<\/pre>\n\n<p>To remove events attached with <code>delegate()<\/code>, see  the <a href=\"http:\/\/api.jquery.com\/undelegate\">.undelegate()<\/a> method.<\/p>\n<p>Passing and handling event data works the same way as it does for <code>.on()<\/code>.<\/p>\n","categories":["Events > Event Handler Attachment","Version > Version 1.4.2","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/dequeue\/","name":"dequeue","title":".dequeue()","type":"method","signatures":[{"added":"1.2","params":[{"name":"queueName","type":"String","optional":"optional","desc":"A string containing the name of the queue. Defaults to <code>fx<\/code>, the standard effects queue."}]}],"desc":"Execute the next function on the queue for the matched elements.","longdesc":"<p>When <code>.dequeue()<\/code> is called, the next function on the queue is removed from the queue, and then executed. This function should in turn (directly or indirectly) cause <code>.dequeue()<\/code> to be called, so that the sequence can continue.<\/p>","categories":["Effects > Custom","Data","Utilities","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/descendant-selector\/","name":"descendant","title":"Descendant Selector (\"ancestor descendant\")","type":"selector","signatures":[{"added":"1.0","params":[{"name":"ancestor","type":"Selector","optional":"","desc":"Any valid selector."},{"name":"descendant","type":"Selector","optional":"","desc":"A selector to filter the descendant elements."}]}],"desc":"Selects all elements that are descendants of a given ancestor.","longdesc":"<p>A descendant of an element could be a child, grandchild, great-grandchild, and so on, of that element.<\/p>","categories":["Selectors > Hierarchy","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/detach\/","name":"detach","title":".detach()","type":"method","signatures":[{"added":"1.4","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A selector expression that filters the set of matched elements to be removed."}]}],"desc":"Remove the set of matched elements from the DOM.","longdesc":"<p>The <code>.detach()<\/code> method is the same as <code><a href=\"\/remove\">.remove()<\/a><\/code>, except that <code>.detach()<\/code> keeps all jQuery data associated with the removed elements. This method is useful when removed elements are to be reinserted into the DOM at a later time.<\/p>","categories":["Manipulation > DOM Removal","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/die\/","name":"die","title":".die()","type":"method","signatures":[{"added":"1.4.1"}],"desc":"Remove all event handlers previously attached using <code>.live()<\/code> from the elements.","longdesc":"\n<p>Any handler that has been attached with <code>.live()<\/code> can be removed with <code>.die()<\/code>. This method is analogous to calling <code>.unbind()<\/code> with no arguments, which is used to remove all handlers attached with <code>.bind()<\/code>.\nSee the discussions of <code>.live()<\/code> and <code>.unbind()<\/code> for further details.<\/p>\n<p><strong>As of jQuery 1.7<\/strong>, use of <code>.die()<\/code> (and its complementary method, <code>.live()<\/code>) is not recommended. Instead, use <a href=\"http:\/\/api.jquery.com\/off\/\"><code>.off()<\/code><\/a> to remove event handlers bound with <a href=\"http:\/\/api.jquery.com\/on\/\"><code>.on()<\/code><\/a><\/p>\n<p><strong>Note:<\/strong> In order for .die() to function correctly, the selector used with it must match exactly the selector initially used with .live().<\/p>\n","categories":["Deprecated","Events > Event Handler Attachment","Version > Version 1.3","Version > Version 1.4.1","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/die\/","name":"die","title":".die()","type":"method","signatures":[{"added":"1.3","params":[{"name":"eventType","type":"String","optional":"","desc":"A string containing a JavaScript event type, such as <code>click<\/code> or <code>keydown<\/code>."},{"name":"handler","type":"String","optional":"optional","desc":"The function that is no longer to be executed."}]},{"added":"1.4.3","params":[{"name":"eventTypes","type":"Map","optional":"","desc":"A map of one or more event types, such as <code>click<\/code> or <code>keydown<\/code> and their corresponding functions that are no longer to be executed."}]}],"desc":"Remove an event handler previously attached using <code>.live()<\/code> from the elements.","longdesc":"\n<p>Any handler that has been attached with <code>.live()<\/code> can be removed with <code>.die()<\/code>. This method is analogous to <code>.unbind()<\/code>, which is used to remove handlers attached with <code>.bind()<\/code>.\nSee the discussions of <code>.live()<\/code> and <code>.unbind()<\/code> for further details.<\/p>\n<p><strong>Note:<\/strong> In order for <code>.die()<\/code> to function correctly, the selector used with it must match exactly the selector initially used with <code>.live()<\/code>.<\/p>\n","categories":["Deprecated","Events > Event Handler Attachment","Version > Version 1.3","Version > Version 1.4.1","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/disabled-selector\/","name":"disabled","title":":disabled Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements that are disabled.","longdesc":"<p>As with other pseudo-class selectors (those that begin with a \":\") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector (\"*\") is implied. In other words, the bare <code>$(':disabled')<\/code> is equivalent to <code>$('*:disabled')<\/code>, so <code>$('input:disabled')<\/code> should be used instead. <\/p>","categories":["Selectors > Form","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/each\/","name":"each","title":".each()","type":"method","signatures":[{"added":"1.0","params":[{"name":"function(index, Element)","type":"Function","optional":"","desc":"A function to execute for each matched element."}]}],"desc":"Iterate over a jQuery object, executing a function for each matched element. ","longdesc":"\n  <p>The <code>.each()<\/code> method is designed to make DOM looping constructs concise and less error-prone. When called it iterates over the DOM elements that are part of the jQuery object. Each time the callback runs, it is passed the current loop iteration, beginning from 0. More importantly, the callback is fired in the context of the current DOM element, so the keyword <code>this<\/code> refers to the element.<\/p>\n  <p>Suppose we had a simple unordered list on the page:<\/p>\n  <pre>&lt;ul&gt;\n    &lt;li&gt;foo&lt;\/li&gt;\n    &lt;li&gt;bar&lt;\/li&gt;\n&lt;\/ul&gt;\n  <\/pre>\n  <p>We can select the list items and iterate across them:<\/p>\n  <pre>$('li').each(function(index) {\n    alert(index + ': ' + $(this).text());\n});\n  <\/pre>\n  <p>A message is thus alerted for each item in the list:<\/p>\n  <p><span class=\"output\">0: foo<\/span><br\/>\n  <span class=\"output\">1: bar<\/span><\/p>\n<p>We can stop the loop from within the callback function by returning <code>false<\/code>.<\/p>  \n  \n","categories":["Miscellaneous > Collection Manipulation","Traversing","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/element-selector\/","name":"element","title":"Element Selector (\"element\")","type":"selector","signatures":[{"added":"1.0","params":[{"name":"element","type":"String","optional":"","desc":"An element to search for. Refers to the tagName of DOM nodes."}]}],"desc":"Selects all elements with the given tag name.","longdesc":"<p>JavaScript's <code>getElementsByTagName()<\/code> function is called to return the appropriate elements when this expression is used.<\/p> ","categories":["Selectors > Basic","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/empty\/","name":"empty","title":".empty()","type":"method","signatures":[{"added":"1.0"}],"desc":"Remove all child nodes of the set of matched elements from the DOM.","longdesc":"<p>This method removes not only child (and other descendant) elements, but also any text within the set of matched elements. This is because, according to the DOM specification, any string of text within an element is considered a child node of that element. Consider the following HTML:<\/p>\n<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"hello\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"goodbye\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n<p>We can target any element for removal:<\/p>\n<pre>$('.hello').empty();<\/pre>\n<p>This will result in a DOM structure with the <code>Hello<\/code> text deleted:<\/p>\n<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"hello\"&gt;&lt;\/div&gt;\n  &lt;div class=\"goodbye\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n<p>If we had any number of nested elements inside <code>&lt;div class=\"hello\"&gt;<\/code>, they would be removed, too. <\/p>\n  <p>To avoid memory leaks, jQuery removes other constructs such as data and event handlers from the child elements before removing the elements themselves.<\/p>\n  <p>If you want to remove elements without destroying their data or event handlers (so they can be re-added later), use .detach() instead.<\/p>\n  ","categories":["Manipulation > DOM Removal","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/empty-selector\/","name":"empty","title":":empty Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Select all elements that have no children (including text nodes).","longdesc":"\n<p>This is the inverse of <code>:parent<\/code>. <\/p>\n<p>One important thing to note with :empty (and :parent) is that child elements include text nodes.<\/p>\n<p>The W3C recommends that the <code>&lt;p&gt;<\/code> element have at least one child node, even if that child is merely text (see http:\/\/www.w3.org\/TR\/html401\/struct\/text.html#edef-P). Some other elements, on the other hand, are empty (i.e. have no children) by definition: &lt;input&gt;, &lt;img&gt;, &lt;br&gt;, and &lt;hr&gt;, for example.<\/p>\n","categories":["Selectors > Content Filter","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/enabled-selector\/","name":"enabled","title":":enabled Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements that are enabled.","longdesc":"<p>As with other pseudo-class selectors (those that begin with a \":\") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector (\"*\") is implied. In other words, the bare <code>$(':enabled')<\/code> is equivalent to <code>$('*:enabled')<\/code>, so <code>$('input:enabled')<\/code> should be used instead. <\/p>","categories":["Selectors > Form","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/end\/","name":"end","title":".end()","type":"method","signatures":[{"added":"1.0"}],"desc":"End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.","longdesc":"<p>Most of jQuery's <a href=\"http:\/\/api.jquery.com\/category\/traversing\">DOM traversal<\/a> methods operate on a jQuery object instance and produce a new one, matching a different set of DOM elements. When this happens, it is as if the new set of elements is pushed onto a stack that is maintained inside the object. Each successive filtering method pushes a new element set onto the stack. If we need an older element set, we can use <code>end()<\/code> to pop the sets back off of the stack.<\/p>\n<p>Suppose we have a couple short lists on a page:<\/p>\n<pre>\n&lt;ul class=\"first\"&gt;\n   &lt;li class=\"foo\"&gt;list item 1&lt;\/li&gt;\n   &lt;li&gt;list item 2&lt;\/li&gt;\n   &lt;li class=\"bar\"&gt;list item 3&lt;\/li&gt;\n&lt;\/ul&gt;\n&lt;ul class=\"second\"&gt;\n   &lt;li class=\"foo\"&gt;list item 1&lt;\/li&gt;\n   &lt;li&gt;list item 2&lt;\/li&gt;\n   &lt;li class=\"bar\"&gt;list item 3&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>The <code>end()<\/code> method is useful primarily when exploiting jQuery's chaining properties. When not using chaining, we can usually just call up a previous object by variable name, so we don't need to manipulate the stack. With <code>end()<\/code>, though, we can string all the method calls together:<\/p>\n<pre>\n$('ul.first').find('.foo').css('background-color', 'red')\n  <code>.end()<\/code>.find('.bar').css('background-color', 'green');\n<\/pre>\n<p>This chain searches for items with the class <code>foo<\/code> within the first list only and turns their backgrounds red. Then <code>end()<\/code> returns the object to its state before the call to <code>find()<\/code>, so the second <code>find()<\/code> looks for '.bar' inside <code>&lt;ul class=\"first\"&gt;<\/code>, not just inside that list's <code>&lt;li class=\"foo\"&gt;<\/code>, and turns the matching elements' backgrounds green. The net result is that items 1 and 3 of the first list have a colored background, and none of the items from the second list do.<\/p>\n<p>A long jQuery chain can be visualized as a structured code block, with filtering methods providing the openings of nested blocks and <code>end()<\/code> methods closing them:<\/p>\n<pre>\n$('ul.first').find('.foo')\n  .css('background-color', 'red')\n.end().find('.bar')\n  .css('background-color', 'green')\n.end();\n<\/pre>\n<p>The last <code>end()<\/code> is unnecessary, as we are discarding the jQuery object immediately thereafter. However, when the code is written in this form, the <code>end()<\/code> provides visual symmetry and a sense of completion \u2014making the program, at least to the eyes of some developers, more readable, at the cost of a slight hit to performance as it is an additional function call.<\/p>","categories":["Traversing > Miscellaneous Traversing","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/eq\/","name":"eq","title":".eq()","type":"method","signatures":[{"added":"1.1.2","params":[{"name":"index","type":"Integer","optional":"","desc":"An integer indicating the 0-based position of the element. "}]},{"added":"1.4","params":[{"name":"-index","type":"Integer","optional":"","desc":"An integer indicating the position of the element, counting backwards  from the last element in the set. "}]}],"desc":"Reduce the set of matched elements to the one at the specified index.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.eq()<\/code> method constructs a new jQuery object from one element within that set. The supplied index identifies the position of this element in the set. <\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n  &lt;ul&gt;\n    &lt;li&gt;list item 1&lt;\/li&gt;\n    &lt;li&gt;list item 2&lt;\/li&gt;\n    &lt;li&gt;list item 3&lt;\/li&gt;\n    &lt;li&gt;list item 4&lt;\/li&gt;\n    &lt;li&gt;list item 5&lt;\/li&gt;\n  &lt;\/ul&gt;\n<\/pre>\n<p>We can apply this method to the set of list items:<\/p>\n<pre>\n  $('li').eq(2).css('background-color', 'red');\n<\/pre>\n<p>The result of this call is a red background for item 3. Note that the supplied index is zero-based, and refers to the position of the element within the jQuery object, not within the DOM tree.<\/p>\n<p>Providing a negative number indicates a position starting from the end of the set, rather than the beginning. For example:<\/p>\n<pre>\n  $('li').eq(-2).css('background-color', 'red');\n<\/pre>\n<p>This time list item 4 is turned red, since it is two from the end of the set.<\/p>\n<p>If an element cannot be found at the specified zero-based index, the method constructs a new jQuery object with an empty set and a <code>length<\/code> property of 0. <\/p>\n<pre>\n  $('li').eq(5).css('background-color', 'red');\n<\/pre>\n<p>Here, none of the list items is turned red, since <code>.eq(5)<\/code> indicates the sixth of five list items.<\/p>\n","categories":["Traversing > Filtering","Version > Version 1.1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/eq-selector\/","name":"eq","title":":eq() Selector","type":"selector","signatures":[{"added":"1.0","params":[{"name":"index","type":"Number","optional":"","desc":"Zero-based index of the element to match."}]}],"desc":"Select the element at index <code>n<\/code> within the matched set.","longdesc":"<p>The index-related selectors (<code>:eq()<\/code>, <code>:lt()<\/code>, <code>:gt()<\/code>, <code>:even<\/code>, <code>:odd<\/code>) filter the set of elements that have matched the expressions that precede them. They narrow the set down based on the order of the elements within this matched set. For example, if elements are first selected with a class selector (<code>.myclass<\/code>) and four elements are returned, these elements are given indices <code>0<\/code> through <code>3<\/code> for the purposes of these selectors.<\/p>\n<p>Note that since JavaScript arrays use <em>0-based indexing<\/em>, these selectors reflect that fact. This is why <code>$('.myclass:eq(1)')<\/code> selects the second element in the document with the class myclass, rather than the first. In contrast, <code>:nth-child(n)<\/code> uses <em>1-based indexing<\/em> to conform to the CSS specification.<\/p>\n<p>Unlike the <a href=\"http:\/\/api.jquery.com\/eq\/\"><code>.eq(index)<\/code><\/a> method, the <code>:eq(index)<\/code> selector does <em>not<\/em> accept a negative value for <code>index<\/code>. For example, while <code>$('li').eq(-1)<\/code> selects the last <code>li<\/code> element, <code>$('li:eq(-1)')<\/code> selects nothing.<\/p>\n","categories":["Selectors > Basic Filter","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/error\/","name":"error","title":".error()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute when the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]}],"desc":"Bind an event handler to the \"error\" JavaScript event.","longdesc":"\n<p>This method is a shortcut for <code>.bind('error', handler)<\/code>.<\/p>\n<p>The <code>error<\/code> event is sent to elements, such as images, that are referenced by a document and loaded by the browser. It is called if the element was not loaded correctly.<\/p>\n<p>For example, consider a page with a simple image element:<\/p>\n<pre>&lt;img alt=\"Book\" id=\"book\" \/&gt;<\/pre>\n<p>The event handler can be bound to the image:<\/p>\n<pre>$('#book')\n  .error(function() {\n    alert('Handler for .error() called.')\n  })\n  .attr(\"src\", \"missing.png\");\n<\/pre>\n<p>If the image cannot be loaded (for example, because it is not present at the supplied URL), the alert  is displayed:<\/p>\n<p><span class=\"output\">Handler for .error() called.<\/span><\/p>\n<blockquote><p>The event handler <em>must<\/em> be attached before the browser fires the error event, which is why the example sets the src attribute after attaching the handler. Also, the error event may not be correctly fired when the page is served locally; <code>error<\/code> relies on HTTP status codes and will generally not be triggered if the URL uses the <code>file:<\/code> protocol.<\/p>\n<\/blockquote>\n<p>Note: A jQuery error event handler should not be attached to the window object. The browser fires the window's error event when a script error occurs. However, the window error event receives different arguments and has different return value requirements than conventional event handlers. Use <code>window.onerror<\/code> instead.\n<\/p>\n","categories":["Events > Browser Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/even-selector\/","name":"even","title":":even Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects even elements, zero-indexed.  See also <a href=\"\/Selectors\/odd\">odd<\/a>.","longdesc":"<p>In particular, note that the <em>0-based indexing<\/em> means that, counter-intuitively, <code>:even<\/code> selects the first element, third element, and so on within the matched set.<\/p>","categories":["Selectors > Basic Filter","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/event.currentTarget\/","name":"event.currentTarget","title":"event.currentTarget","type":"property","signatures":[{"added":"1.3"}],"desc":" The current DOM element within the event bubbling phase.  ","longdesc":"<p>This property will typically be equal to the <code>this<\/code> of the function.<\/p>\n<p><em>If you are using <a href=\"\/jQuery.proxy\">jQuery.proxy<\/a> or another form of scope manipulation, <code>this<\/code> will be equal to whatever context you have provided, not <code>event.currentTarget<\/code><\/em><\/p>\n  ","categories":["Events > Event Object","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/event.data\/","name":"event.data","title":"event.data","type":"property","signatures":[{"added":"1.1"}],"desc":"An optional data map passed to an event method when the current executing handler is bound.  ","longdesc":"   ","categories":["Events > Event Object","Version > Version 1.1"],"download":""},{"url":"http:\/\/api.jquery.com\/event.delegateTarget\/","name":"event.delegateTarget","title":"event.delegateTarget","type":"property","signatures":[{"added":"1.7"}],"desc":"The element where the currently-called jQuery event handler was attached.","longdesc":"<p>This property is most often useful in delegated events attached by <a href=\"\/delegate\"><code>.delegate()<\/code><\/a> or <a href=\"\/on\"><code>.on()<\/code><\/a>, where the event handler is attached at an ancestor of the element being processed. It can be used, for example, to identify and remove event handlers at the delegation point.<\/p>\n<p>For non-delegated event handlers attached directly to an element, <code>event.delegateTarget<\/code> will always be equal to <code>event.currentTarget<\/code>.<\/p>\n  ","categories":["Events > Event Object","Events","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/event.isDefaultPrevented\/","name":"event.isDefaultPrevented","title":"event.isDefaultPrevented()","type":"method","signatures":[{"added":"1.3"}],"desc":"Returns whether <a href=\"\/event.preventDefault\">event.preventDefault()<\/a> was ever called on this event object. ","longdesc":"   ","categories":["Events > Event Object","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/event.isImmediatePropagationStopped\/","name":"event.isImmediatePropagationStopped","title":"event.isImmediatePropagationStopped()","type":"method","signatures":[{"added":"1.3"}],"desc":"  Returns whether event.stopImmediatePropagation() was ever called on this event object. ","longdesc":" <p>This property was introduced in <a href=\"http:\/\/www.w3.org\/TR\/2003\/NOTE-DOM-Level-3-Events-20031107\/events.html#Events-Event-isImmediatePropagationStopped\">DOM level 3<\/a>.<\/p>  ","categories":["Events > Event Object","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/event.isPropagationStopped\/","name":"event.isPropagationStopped","title":"event.isPropagationStopped()","type":"method","signatures":[{"added":"1.3"}],"desc":"  Returns whether <a href=\"\/event.stopPropagation\">event.stopPropagation()<\/a> was ever called on this event object. ","longdesc":"<p>This event method is described in the <a href=\"http:\/\/www.w3.org\/TR\/2003\/WD-DOM-Level-3-Events-20030331\/events.html#Events-Event-isPropagationStopped\">W3C DOM Level 3 specification<\/a>.<\/p>","categories":["Events > Event Object","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/event.namespace\/","name":"event.namespace","title":"event.namespace","type":"property","signatures":[{"added":"1.4.3"}],"desc":"The namespace specified when the event was triggered.","longdesc":"<p>This will likely be used primarily by plugin authors who wish to handle tasks differently depending on the event namespace used.<\/p>","categories":["Events > Event Object","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/event.pageX\/","name":"event.pageX","title":"event.pageX","type":"property","signatures":[{"added":"1.0.4"}],"desc":"The mouse position relative to the left edge of the document. ","longdesc":"   ","categories":["Events > Event Object","Version > Version 1.0.4"],"download":""},{"url":"http:\/\/api.jquery.com\/event.pageY\/","name":"event.pageY","title":"event.pageY","type":"property","signatures":[{"added":"1.0.4"}],"desc":"The mouse position relative to the top edge of the document. ","longdesc":"   ","categories":["Events > Event Object","Version > Version 1.0.4"],"download":""},{"url":"http:\/\/api.jquery.com\/event.preventDefault\/","name":"event.preventDefault","title":"event.preventDefault()","type":"","signatures":[{"added":"1.0"}],"desc":" If this method is called, the default action of the event will not be triggered. ","longdesc":" <p>For example, clicked anchors will not take the browser to a new URL. We can use <code>event.isDefaultPrevented()<\/code> to determine if this method has been called by an event handler that was triggered by this event.<\/p>  ","categories":["Events > Event Object","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/event.relatedTarget\/","name":"event.relatedTarget","title":"event.relatedTarget","type":"property","signatures":[{"added":"1.1.4"}],"desc":"  The other DOM element involved in the event, if any. ","longdesc":"<p>For <code>mouseout<\/code>, indicates the element being entered; for <code>mouseover<\/code>, indicates the element being exited. <\/p> ","categories":["Events > Event Object","Version > Version 1.1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/event.result\/","name":"event.result","title":"event.result","type":"property","signatures":[{"added":"1.3"}],"desc":" The last value returned by an event handler that was triggered by this event, unless the value was <code>undefined<\/code>.  ","longdesc":" <p>This property can be useful for getting previous return values of custom events. <\/p>","categories":["Events > Event Object","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/event.stopImmediatePropagation\/","name":"event.stopImmediatePropagation","title":"event.stopImmediatePropagation()","type":"method","signatures":[{"added":"1.3"}],"desc":" Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.\n  ","longdesc":"<p>In addition to keeping any additional handlers on an element from being executed, this method also stops the bubbling by implicitly calling <code>event.stopPropagation()<\/code>. To simply prevent the event from bubbling to ancestor elements but allow other event handlers to execute on the same element, we can use <code><a href=\"http:\/\/api.jquery.com\/event.stopPropagation\">event.stopPropagation()<\/a><\/code> instead.<\/p>\n<p>Use <code><a href=\"http:\/\/api.jquery.com\/event.isImmediatePropagationStopped\">event.isImmediatePropagationStopped()<\/a><\/code> to know whether this method was ever called (on that event object).<\/p> ","categories":["Events > Event Object","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/event.stopPropagation\/","name":"event.stopPropagation","title":"event.stopPropagation()","type":"method","signatures":[{"added":"1.0"}],"desc":"Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.   ","longdesc":"  <p>We can use <code><a href=\"\/event.isPropagationStopped\">event.isPropagationStopped()<\/a><\/code> to determine if this method was ever called (on that event object). <\/p>\n    <p>This method works for custom events triggered with <a href=\"\/trigger\">trigger()<\/a>, as well.<\/p>\n<p>Note that this will not prevent other handlers <em>on the same element<\/em> from running. <\/p> ","categories":["Events > Event Object","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/event.target\/","name":"event.target","title":"event.target","type":"property","signatures":[{"added":"1.0"}],"desc":" The DOM element that initiated the event.  ","longdesc":" <p>The <code>target<\/code> property can be the element that registered for the event or a descendant of it.  It is often useful to compare <code>event.target<\/code> to <code>this<\/code> in order to determine if the event is being handled due to event bubbling. This property is very useful in event delegation, when events bubble.<\/p>","categories":["Events > Event Object","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/event.timeStamp\/","name":"event.timeStamp","title":"event.timeStamp","type":"property","signatures":[{"added":"1.2.6"}],"desc":"The difference in milliseconds between the time the browser created the event and January 1, 1970.","longdesc":"<p>This property can be useful for profiling event performance by getting the <code>event.timeStamp<\/code> value at two points in the code and noting the difference. To simply determine the current time inside an event handler, use <code>(new Date).getTime()<\/code> instead.<\/p> \n<p>Note: Due to a <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=238041\">bug open since 2004<\/a>, this value is not populated correctly in Firefox and it is not possible to know the time the event was created in that browser.<\/p>\n","categories":["Events > Event Object","Version > Version 1.2.6"],"download":""},{"url":"http:\/\/api.jquery.com\/event.type\/","name":"event.type","title":"event.type","type":"property","signatures":[{"added":"1.0"}],"desc":" Describes the nature of the event.  ","longdesc":"   ","categories":["Events > Event Object","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/event.which\/","name":"event.which","title":"event.which","type":"property","signatures":[{"added":"1.1.3"}],"desc":" For key or mouse events, this property indicates the specific key or button that was pressed.  ","longdesc":"<p>The <code>event.which<\/code> property normalizes <code>event.keyCode<\/code> and <code>event.charCode<\/code>. It is recommended to watch <code>event.which<\/code> for keyboard key input. For more detail, read about <a href=\"https:\/\/developer.mozilla.org\/en\/DOM\/event.charCode#Notes\">event.charCode on the MDC<\/a>. <\/p>\n      <p><code>event.which<\/code> also normalizes button presses (<code>mousedown<\/code> and <code>mouseup<\/code>events), reporting <code>1<\/code> for left button, <code>2<\/code> for middle, and <code>3<\/code> for right. Use <code>event.which<\/code> instead of <code>event.button<\/code>.  <\/p>","categories":["Events > Event Object","Version > Version 1.1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/fadeIn\/","name":"fadeIn","title":".fadeIn()","type":"method","signatures":[{"added":"1.0","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.4.3","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]}],"desc":"Display the matched elements by fading them to opaque.","longdesc":"\n    <p>The <code>.fadeIn()<\/code> method animates the opacity of the matched elements.<\/p>\n    <p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively. If any other string is supplied, or if the <code>duration<\/code> parameter is omitted, the default duration of  <code>400<\/code> milliseconds is used.<\/p>\n    <p>We can animate any element, such as a simple image:<\/p>\n    <pre>&lt;div id=\"clickme\"&gt;\n      Click here\n    &lt;\/div&gt;\n    &lt;img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \/&gt;\n    With the element initially hidden, we can show it slowly:\n    $('#clickme').click(function() {\n      $('#book').fadeIn('slow', function() {\n        \/\/ Animation complete\n      });\n    });<\/pre>\n    <p class=\"image four-across\">\n      <img src=\"\/images\/0042_06_33.png\" alt=\"\"\/>\n      <img src=\"\/images\/0042_06_34.png\" alt=\"\"\/>\n      <img src=\"\/images\/0042_06_35.png\" alt=\"\"\/>\n      <img src=\"\/images\/0042_06_36.png\" alt=\"\"\/>\n    <\/p>\n\n    <h4 id=\"easing\">Easing<\/h4>\n    <p><strong>As of jQuery 1.4.3<\/strong>, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing<\/code>, and one that progresses at a constant pace, called <code>linear<\/code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http:\/\/jqueryui.com\">jQuery UI suite<\/a>.<\/p>\n    <h4 id=\"callback-function\">Callback Function<\/h4>\n    <p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole. <\/p>\n  <p><strong>As of jQuery 1.6<\/strong>, the <code><a href=\"http:\/\/api.jquery.com\/promise\/\">.promise()<\/a><\/code> method can be used in conjunction with the <code><a href=\"http:\/\/api.jquery.com\/deferred.done\/\">deferred.done()<\/a><\/code> method to execute a single callback for the animation as a whole when <em>all<\/em> matching elements have completed their animations ( See the <a href=\"http:\/\/api.jquery.com\/promise\/#example-1\">example for .promise()<\/a> ).  <\/p>\n  ","categories":["Effects > Fading","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/fadeOut\/","name":"fadeOut","title":".fadeOut()","type":"method","signatures":[{"added":"1.0","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.4.3","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]}],"desc":"Hide the matched elements by fading them to transparent.","longdesc":"\n    <p>The <code>.fadeOut()<\/code> method animates the opacity of the matched elements. Once the opacity reaches 0, the <code>display<\/code> style property is set to <code>none<\/code>, so the element no longer affects the layout of the page.<\/p>\n    <p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively. If any other string is supplied, or if the <code>duration<\/code> parameter is omitted, the default duration of  <code>400<\/code> milliseconds is used.<\/p>\n    <p>We can animate any element, such as a simple image:<\/p>\n<pre>&lt;div id=\"clickme\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \/&gt;<\/pre>\n<p>With the element initially shown, we can hide it slowly:<\/p>\n<pre>$('#clickme').click(function() {\n  $('#book').fadeOut('slow', function() {\n    \/\/ Animation complete.\n  });\n});<\/pre>\n    <p class=\"image four-across\">\n      <img src=\"\/images\/0042_06_37.png\" alt=\"\"\/>\n      <img src=\"\/images\/0042_06_38.png\" alt=\"\"\/>\n      <img src=\"\/images\/0042_06_39.png\" alt=\"\"\/>\n      <img src=\"\/images\/0042_06_40.png\" alt=\"\"\/>\n    <\/p>\n<blockquote>\n<p><strong>Note: <\/strong>To avoid unnecessary DOM manipulation, <code>.fadeOut()<\/code> will not hide an element that is already considered hidden. For information on which elements jQuery considers hidden, see <a href=\"http:\/\/api.jquery.com\/hidden-selector\"> :hidden Selector<\/a>.<\/p>\n<\/blockquote>\n    <h4 id=\"easing\">Easing<\/h4>\n    <p><strong>As of jQuery 1.4.3<\/strong>, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing<\/code>, and one that progresses at a constant pace, called <code>linear<\/code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http:\/\/jqueryui.com\">jQuery UI suite<\/a>.<\/p>\n    <h4 id=\"callback-function\">Callback Function<\/h4>\n    <p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n<p><strong>As of jQuery 1.6<\/strong>, the <code><a href=\"http:\/\/api.jquery.com\/promise\/\">.promise()<\/a><\/code> method can be used in conjunction with the <code><a href=\"http:\/\/api.jquery.com\/deferred.done\/\">deferred.done()<\/a><\/code> method to execute a single callback for the animation as a whole when <em>all<\/em> matching elements have completed their animations ( See the <a href=\"http:\/\/api.jquery.com\/promise\/#example-1\">example for .promise()<\/a> ).  <\/p>\n  ","categories":["Effects > Fading","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/fadeTo\/","name":"fadeTo","title":".fadeTo()","type":"method","signatures":[{"added":"1.0","params":[{"name":"duration","type":"String,Number","optional":"","desc":"A string or number determining how long the animation will run."},{"name":"opacity","type":"Number","optional":"","desc":"A number between 0 and 1 denoting the target opacity."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.4.3","params":[{"name":"duration","type":"String,Number","optional":"","desc":"A string or number determining how long the animation will run."},{"name":"opacity","type":"Number","optional":"","desc":"A number between 0 and 1 denoting the target opacity."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]}],"desc":"Adjust the opacity of the matched elements.","longdesc":"\n  <p>The <code>.fadeTo()<\/code> method animates the opacity of the matched elements.<\/p>\n  <p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively. If any other string is supplied, the default duration of  <code>400<\/code> milliseconds is used. Unlike the other effect methods, <code>.fadeTo()<\/code> requires that <code>duration<\/code> be explicitly specified.<\/p>\n  <p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n  <p>We can animate any element, such as a simple image:<\/p>\n  <pre>&lt;div id=\"clickme\"&gt;\n    Click here\n  &lt;\/div&gt;\n  &lt;img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \/&gt;\n  With the element initially shown, we can dim it slowly:\n  $('#clickme').click(function() {\n    $('#book').fadeTo('slow', 0.5, function() {\n      \/\/ Animation complete.\n    });\n  });\n  <\/pre>\n  <p class=\"image four-across\"> \n    <img src=\"\/images\/0042_06_41.png\" alt=\"\"\/>\n    <img src=\"\/images\/0042_06_42.png\" alt=\"\"\/>\n    <img src=\"\/images\/0042_06_43.png\" alt=\"\"\/>\n    <img src=\"\/images\/0042_06_44.png\" alt=\"\"\/>\n  <\/p>\n  <p>With <code>duration<\/code> set to <code>0<\/code>, this method just changes the <code>opacity<\/code> CSS property, so <code>.fadeTo(0, opacity)<\/code> is the same as <code>.css('opacity', opacity)<\/code>.<\/p>\n","categories":["Effects > Fading","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/fadeToggle\/","name":"fadeToggle","title":".fadeToggle()","type":"method","signatures":[{"added":"1.4.4","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Function","optional":"optional","desc":"A function to call once the animation is complete."}]}],"desc":"Display or hide the matched elements by animating their opacity.","longdesc":"\n  <p>The <code>.fadeToggle()<\/code> method animates the opacity of the matched elements. When called on a visible element, the element's <code>display<\/code> style property is set to <code>none<\/code> once the opacity reaches 0, so the element no longer affects the layout of the page.<\/p>\n  <p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively.<\/p>\n    <h4 id=\"easing\">Easing<\/h4>\n <p>The string representing an easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing<\/code>, and one that progresses at a constant pace, called <code>linear<\/code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http:\/\/jqueryui.com\">jQuery UI suite<\/a>.<\/p>\n    <h4 id=\"callback-function\">Callback Function<\/h4>\n  <p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n  <p><strong>As of jQuery 1.6<\/strong>, the <code><a href=\"http:\/\/api.jquery.com\/promise\/\">.promise()<\/a><\/code> method can be used in conjunction with the <code><a href=\"http:\/\/api.jquery.com\/deferred.done\/\">deferred.done()<\/a><\/code> method to execute a single callback for the animation as a whole when <em>all<\/em> matching elements have completed their animations ( See the <a href=\"http:\/\/api.jquery.com\/promise\/#example-1\">example for .promise()<\/a> ).  <\/p>\n\n  ","categories":["Effects","Effects > Fading","Version > Version 1.4.4"],"download":""},{"url":"http:\/\/api.jquery.com\/file-selector\/","name":"file","title":":file Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements of type file.","longdesc":"<p><code>:file<\/code> is equivalent to <code>[type=\"file\"]<\/code>. As with other pseudo-class selectors (those that begin with a \":\") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector (\"*\") is implied. In other words, the bare <code>$(':file')<\/code> is equivalent to <code>$('*:file')<\/code>, so <code>$('input:file')<\/code> should be used instead. <\/p>","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/filter\/","name":"filter","title":".filter()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"","desc":"A string containing a selector expression to match the current set of elements against."}]},{"added":"1.0","params":[{"name":"function(index)","type":"Function","optional":"","desc":"A function used as a test for each element in the set. <code>this<\/code> is the current DOM element."}]},{"added":"1.4","params":[{"name":"element","type":"Element","optional":"","desc":"An element to match the current set of elements against."}]},{"added":"1.4","params":[{"name":"jQuery object","type":"Object","optional":"","desc":"An existing jQuery object to match the current set of elements against."}]}],"desc":"Reduce the set of matched elements to those that match the selector or pass the function's test. ","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.filter()<\/code> method constructs a new jQuery object from a subset of the matching elements. The supplied selector is tested against each element; all elements matching the selector will be included in the result.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n&lt;ul&gt;\n  &lt;li&gt;list item 1&lt;\/li&gt;\n  &lt;li&gt;list item 2&lt;\/li&gt;\n  &lt;li&gt;list item 3&lt;\/li&gt;\n  &lt;li&gt;list item 4&lt;\/li&gt;\n  &lt;li&gt;list item 5&lt;\/li&gt;\n  &lt;li&gt;list item 6&lt;\/li&gt;\n&lt;\/ul&gt;\n<p>We can apply this method to the set of list items:<\/p>\n<pre>\n  $('li').filter(':even').css('background-color', 'red');\n<\/pre>\n<p>The result of this call is a red background for items 1, 3, and 5, as they match the selector (recall that <code>:even<\/code> and <code>:odd<\/code> use 0-based indexing).<\/p>\n<h4 id=\"using-filter-function\">Using a Filter Function<\/h4>\n<p>The second form of this method allows us to filter elements against a function rather than a selector. For each element, if the function returns <code>true<\/code> (or a \"truthy\" value), the element will be included in the filtered set; otherwise, it will be excluded. Suppose we have a somewhat more involved HTML snippet:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li&gt;&lt;strong&gt;list&lt;\/strong&gt; item 1 -\n    one strong tag&lt;\/li&gt;\n  &lt;li&gt;&lt;strong&gt;list&lt;\/strong&gt; item &lt;strong&gt;2&lt;\/strong&gt; -\n    two &lt;span&gt;strong tags&lt;\/span&gt;&lt;\/li&gt;\n  &lt;li&gt;list item 3&lt;\/li&gt;\n  &lt;li&gt;list item 4&lt;\/li&gt;\n  &lt;li&gt;list item 5&lt;\/li&gt;\n  &lt;li&gt;list item 6&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>We can select the list items, then filter them based on their contents:<\/p>\n<pre>\n$('li').filter(function(index) {\n  return $('strong', this).length == 1;\n}).css('background-color', 'red');\n<\/pre>\n<p>This code will alter the first list item only, as it contains exactly one <code>&lt;strong&gt;<\/code> tag. Within the filter function, <code>this<\/code> refers to each DOM element in turn. The parameter passed to the function tells us the index of that DOM element within the set matched by the jQuery object.<\/p>\n<p>We can also take advantage of the <code>index<\/code> passed through the function, which indicates the 0-based position of the element within the unfiltered set of matched elements:<\/p>\n<pre>\n$('li').filter(function(index) {\n  return index % 3 == 2;\n}).css('background-color', 'red');\n<\/pre>\n<p>This alteration to the code will cause the third and sixth list items to be highlighted, as it uses the modulus operator (<code>%<\/code>) to select every item with an <code>index<\/code> value that, when divided by 3, has a remainder of <code>2<\/code>.<\/p>\n","categories":["Traversing > Filtering","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/find\/","name":"find","title":".find()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"","desc":"A string containing a selector expression to match elements against."}]},{"added":"1.6","params":[{"name":"jQuery object","type":"Object","optional":"","desc":"A jQuery object to match elements against."}]},{"added":"1.6","params":[{"name":"element","type":"Element","optional":"","desc":"An element to match elements against."}]}],"desc":"Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.find()<\/code> method allows us to search through the descendants of these elements in the DOM tree and construct a new jQuery object from the matching elements. The <code>.find()<\/code> and <code>.children()<\/code> methods are similar, except that the latter only travels a single level down the DOM tree.<\/p>\n  <p>The first signature for the <code>.find()<\/code>method accepts a selector expression of the same type that we can pass to the <code>$()<\/code> function. The elements will be filtered by testing whether they match this selector.<\/p>\n  <p>Consider a page with a basic nested list on it:<\/p>\n<pre>\n&lt;ul class=\"level-1\"&gt;\n  &lt;li class=\"item-i\"&gt;I&lt;\/li&gt;\n  &lt;li class=\"item-ii\"&gt;II\n    &lt;ul class=\"level-2\"&gt;\n      &lt;li class=\"item-a\"&gt;A&lt;\/li&gt;\n      &lt;li class=\"item-b\"&gt;B\n        &lt;ul class=\"level-3\"&gt;\n          &lt;li class=\"item-1\"&gt;1&lt;\/li&gt;\n          &lt;li class=\"item-2\"&gt;2&lt;\/li&gt;\n          &lt;li class=\"item-3\"&gt;3&lt;\/li&gt;\n        &lt;\/ul&gt;\n      &lt;\/li&gt;\n      &lt;li class=\"item-c\"&gt;C&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/li&gt;\n  &lt;li class=\"item-iii\"&gt;III&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n  <p>If we begin at item II, we can find list items within it:<\/p>\n  <pre>$('li.item-ii').find('li').css('background-color', 'red');<\/pre>\n  <p>The result of this call is a red background on items A, B, 1, 2, 3, and C. Even though item II matches the selector expression, it is not included in the results; only descendants are considered candidates for the match.<\/p>\n  <blockquote><p>Unlike in the rest of the tree traversal methods, the selector expression is required in a call to <code>.find()<\/code>. If we need to retrieve all of the descendant elements, we can pass in the universal selector <code>'*'<\/code> to accomplish this.<\/p><\/blockquote>\n  <p><a href=\"http:\/\/api.jquery.com\/jquery\/#selector-context\">Selector context<\/a> is implemented with the <code>.find()<\/code> <code>method;<\/code> therefore, <code>$('li.item-ii').find('li')<\/code> is equivalent to <code>$('li', 'li.item-ii')<\/code>.<\/p>\n  <p><strong>As of jQuery 1.6<\/strong>, we can also filter the selection with a given jQuery collection or element. With the same nested list as above, if we start with:<\/p>\n  <pre>var $allListElements = $('li');<\/pre>\n  <p>And then pass this jQuery object to find:<\/p>\n  <pre>$('li.item-ii').find( $allListElements );<\/pre>\n  <p>This will return a jQuery collection which contains only the list elements that are descendants of item II.<\/p>\n  <p>Similarly, an element may also be passed to find:<\/p>\n<pre>\nvar item1 = $('li.item-1')[0];\n$('li.item-ii').find( item1 ).css('background-color', 'red');\n<\/pre>\n  <p>The result of this call would be a red background on item 1.<\/p>\n","categories":["Traversing > Tree Traversal","Version > Version 1.0","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/first\/","name":"first","title":".first()","type":"method","signatures":[{"added":"1.4"}],"desc":"Reduce the set of matched elements to the first in the set.","longdesc":"[<p>Given a jQuery object that represents a set of DOM elements, the <code>.first()<\/code> method constructs a new jQuery object from the first matching element.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li&gt;list item 1&lt;\/li&gt;\n  &lt;li&gt;list item 2&lt;\/li&gt;\n  &lt;li&gt;list item 3&lt;\/li&gt;\n  &lt;li&gt;list item 4&lt;\/li&gt;\n  &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>We can apply this method to the set of list items:<\/p>\n<pre>$('li').first().css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background for the first item.<\/p>","categories":["Traversing > Filtering","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/first-child-selector\/","name":"first-child","title":":first-child Selector","type":"selector","signatures":[{"added":"1.1.4"}],"desc":"Selects all elements that are the first child of their parent.","longdesc":"<p>While <a href=\"\/first-selector\">:first<\/a> matches only a single element, the <code>:first-child<\/code> selector can match more than one: one for each parent. This is equivalent to <code>:nth-child(1)<\/code>.<\/p>","categories":["Selectors > Child Filter","Version > Version 1.1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/first-selector\/","name":"first","title":":first Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects the first matched element.","longdesc":"<p>The <code>:first<\/code> pseudo-class is equivalent to <code>:eq(0)<\/code>. It could also be written as <code>:lt(1)<\/code>. While this matches only a single element, <a href=\"first-child-selector\">:first-child<\/a> can match more than one: One for each parent.<\/p>","categories":["Selectors > Basic Filter","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/focus\/","name":"focus","title":".focus()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"focus\" JavaScript event, or trigger that event on an element.","longdesc":"\n<ul>\n<li>This method is a shortcut for <code>.bind('focus', handler)<\/code> in the first and second variations, and <code>.trigger('focus')<\/code> in the third.<\/li>\n<li>The <code>focus<\/code> event is sent to an element when it gains focus. This event is implicitly applicable to a limited set of elements, such as  form elements (<code>&lt;input&gt;<\/code>, <code>&lt;select&gt;<\/code>, etc.) and links (<code>&lt;a href&gt;<\/code>). In recent browser versions, the event can be extended to include all element types by explicitly setting the element's <code>tabindex<\/code> property. An element can gain focus via keyboard commands, such as the Tab key, or by mouse clicks on the element.<\/li>\n<li>Elements with focus are usually highlighted in some way by the browser, for example with a dotted line surrounding the element. The focus is used to determine which element is the first to receive keyboard-related events.<\/li>\n<\/ul>\n<blockquote><p>Attempting to set focus to a hidden element causes an error in Internet Explorer. Take care to only use <code>.focus()<\/code> on elements that are visible. To run an element's focus event handlers without setting focus to the element, use <code>.triggerHandler(\"focus\")<\/code> instead of <code>.focus()<\/code>.<\/p><\/blockquote>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;form&gt;\n  &lt;input id=\"target\" type=\"text\" value=\"Field 1\" \/&gt;\n  &lt;input type=\"text\" value=\"Field 2\" \/&gt;\n&lt;\/form&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;\n<\/pre>\n<p>The event handler can be bound to the first input field:<\/p>\n<pre>$('#target').focus(function() {\n  alert('Handler for .focus() called.');\n});<\/pre>\n<p>Now clicking on the first field, or tabbing to it from another field, displays the alert:<\/p>\n<p><span class=\"output\">Handler for .focus() called.<\/span><\/p>\n<p>We can trigger the event when another element is clicked:<\/p>\n<pre>$('#other').click(function() {\n  $('#target').focus();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also alert the message.<\/p>\n<p>The <code>focus<\/code> event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the <code>focus<\/code> event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping <code>focus<\/code> to the <code>focusin<\/code> event in its event delegation methods, <a href=\"http:\/\/api.jquery.com\/live\/\"><code>.live()<\/code><\/a> and <a href=\"http:\/\/api.jquery.com\/delegate\/\"><code>.delegate()<\/code><\/a>.<\/p>\n","categories":["Events > Form Events","Forms","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/focus-selector\/","name":"focus","title":":focus selector","type":"selector","signatures":[{"added":"1.6"}],"desc":"Selects element if it is currently focused.","longdesc":"<p>As with other pseudo-class selectors (those that begin with a \":\"), it is recommended to precede <code>:focus<\/code> with a tag name or some other selector; otherwise, the universal selector (\"*\") is implied. In other words, the bare <code>$(':focus')<\/code> is equivalent to <code>$('*:focus')<\/code>.  If you are looking for the currently focused element, <code>$( document.activeElement )<\/code> will retrieve it without having to search the whole DOM tree.<\/p>","categories":["Selectors > Basic Filter","Selectors > Form","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/focusin\/","name":"focusin","title":".focusin()","type":"method","signatures":[{"added":"1.4","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]}],"desc":"Bind an event handler to the \"focusin\" event.","longdesc":"<p>This method is a shortcut for <code>.bind('focusin', handler)<\/code>.<\/p>\n<p>The <code>focusin<\/code> event is sent to an element when it, or any element inside of it, gains focus. This is distinct from the <a href=\"\/focus\">focus<\/a> event in that it supports detecting the focus event on parent elements (in other words, it supports event bubbling).<\/p>\n<p>This event will likely be used together with the <a href=\"\/focusout\">focusout<\/a> event.<\/p>","categories":["Events > Keyboard Events","Events > Mouse Events","Version > Version 1.4","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/focusout\/","name":"focusout","title":".focusout()","type":"method","signatures":[{"added":"1.4","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]}],"desc":"Bind an event handler to the \"focusout\" JavaScript event.","longdesc":"<p>This method is a shortcut for <code>.bind('focusout', handler)<\/code>.<\/p>\n<p>The <code>focusout<\/code> event is sent to an element when it, or any element inside of it, loses focus. This is distinct from the <a href=\"\/blur\">blur<\/a> event in that it supports detecting the loss of focus from parent elements (in other words, it supports event bubbling).<\/p>\n<p>This event will likely be used together with the <a href=\"\/focusin\">focusin<\/a> event.<\/p>","categories":["Events > Keyboard Events","Events > Mouse Events","Version > Version 1.4","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/get\/","name":"get","title":".get()","type":"method","signatures":[{"added":"1.0","params":[{"name":"index","type":"Number","optional":"optional","desc":"A zero-based integer indicating which element to retrieve."}]}],"desc":"Retrieve the DOM elements matched by the jQuery object.","longdesc":"<p>The <code>.get()<\/code> method grants us access to the DOM nodes underlying each jQuery object. Suppose we had a simple unordered list on the page:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li id=\"foo\"&gt;foo&lt;\/li&gt;\n  &lt;li id=\"bar\"&gt;bar&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>Without a parameter, <code>.get()<\/code> returns all of the elements:<\/p>\n<pre>alert($('li').get());<\/pre>\n<p>All of the matched DOM nodes are returned by this call, contained in a standard array:<\/p>\n<p><span class=\"result\">[&lt;li id=\"foo\"&gt;, &lt;li id=\"bar\"&gt;]<\/span><\/p>\n<p>With an index specified, .get() will retrieve a single element:<\/p>\n<pre>($('li').get(0));<\/pre>\n<p>Since the index is zero-based, the first list item is returned:<\/p>\n<p><span class=\"output\">&lt;li id=\"foo\"&gt;<\/span><\/p>\n<p>Each jQuery object also masquerades as an array, so we can use the array dereferencing operator to get at the list item instead:<\/p>\n<pre>alert($('li')[0]);<\/pre>\n<p>However, this syntax lacks some of the additional capabilities of .get(), such as specifying a negative index:<\/p>\n<pre>alert($('li').get(-1));<\/pre>\n<p>A negative index is counted from the end of the matched set, so this example will return the last item in the list:<\/p>\n<p><span class=\"output\">&lt;li id=\"bar\"&gt;<\/span><\/p>","categories":["Miscellaneous > DOM Element Methods","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/gt-selector\/","name":"gt","title":":gt() Selector","type":"selector","signatures":[{"added":"1.0","params":[{"name":"index","type":"Number","optional":"","desc":"Zero-based index."}]}],"desc":"Select all elements at an index greater than <code>index<\/code> within the matched set.","longdesc":"<p><strong>index-related selectors<\/strong><\/p>\n                  <p>The index-related selector expressions (including this \"greater than\" selector) filter the set of elements that have matched the expressions that precede them. They narrow the set down based on the order of the elements within this matched set. For example, if elements are first selected with a class selector (<code>.myclass<\/code>) and four elements are returned, these elements are given indices 0 through 3 for the purposes of these selectors.<\/p>\n                <p>Note that since JavaScript arrays use <em>0-based indexing<\/em>, these selectors reflect that fact. This is why <code>$('.myclass:gt(1)')<\/code> selects elements after the second element in the document with the class <code>myclass<\/code>, rather than after the first. In contrast, <code>:nth-child(n)<\/code> uses <em>1-based indexing<\/em> to conform to the CSS specification.<\/p>\n                ","categories":["Selectors > Basic Filter","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/has\/","name":"has","title":".has()","type":"method","signatures":[{"added":"1.4","params":[{"name":"selector","type":"String","optional":"","desc":"A string containing a selector expression to match elements against."}]},{"added":"1.4","params":[{"name":"contained","type":"Element","optional":"","desc":"A DOM element to match elements against."}]}],"desc":"Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.","longdesc":"\n    <p>Given a jQuery object that represents a set of DOM elements, the <code>.has()<\/code> method constructs a new jQuery object from a subset of the matching elements. The supplied selector is tested against the descendants of the matching elements; the element will be included in the result if any of its descendant elements matches the selector.<\/p>\n    <p>Consider a page with a nested list as follows:<\/p>\n<pre>\n &lt;ul&gt;\n  &lt;li&gt;list item 1&lt;\/li&gt;\n  &lt;li&gt;list item 2\n    &lt;ul&gt;\n      &lt;li&gt;list item 2-a&lt;\/li&gt;\n      &lt;li&gt;list item 2-b&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/li&gt;\n  &lt;li&gt;list item 3&lt;\/li&gt;\n  &lt;li&gt;list item 4&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n  <p>We can apply this method to the set of list items as follows:<\/p>\n  <pre>$('li').has('ul').css('background-color', 'red');<\/pre>\n  <p>The result of this call is a red background for item 2, as it is the only <code>&lt;li&gt;<\/code> that has a <code>&lt;ul&gt;<\/code> among its descendants.<\/p>\n\n  ","categories":["Traversing > Filtering","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/has-attribute-selector\/","name":"attributeHas","title":"Has Attribute Selector [name]","type":"selector","signatures":[{"added":"1.0","params":[{"name":"attribute","type":"String","optional":"","desc":"An attribute name."}]}],"desc":"Selects elements that have the specified attribute, with any value. ","longdesc":"<longdesc\/>","categories":["Selectors > Attribute","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/has-selector\/","name":"has","title":":has() Selector","type":"selector","signatures":[{"added":"1.1.4","params":[{"name":"selector","type":"Selector","optional":"","desc":"Any selector."}]}],"desc":"Selects elements which contain at least one element that matches the specified selector.","longdesc":"<p>The expression <code>$('div:has(p)')<\/code> matches a <code>&lt;div&gt;<\/code> if a <code>&lt;p&gt;<\/code> exists anywhere among its descendants, not just as a direct child.<\/p> ","categories":["Selectors > Content Filter","Selectors > jQuery Extensions","Version > Version 1.1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/hasClass\/","name":"hasClass","title":".hasClass()","type":"method","signatures":[{"added":"1.2","params":[{"name":"className","type":"String","optional":"","desc":"The class name to search for."}]}],"desc":"Determine whether any of the matched elements are assigned the given class.","longdesc":"<p>Elements may have more than one class assigned to them. In HTML, this is represented by separating the class names with a space:<\/p>\n\t\t<pre>&lt;div id=\"mydiv\" class=\"foo bar\"&gt;&lt;\/div&gt;<\/pre>\n\t\t<p>The <code>.hasClass()<\/code> method will return <code>true<\/code> if the class is assigned to an element, even if other classes also are. For example, given the HTML above, the following will return <code>true<\/code>:<\/p>\n\t\t<pre>$('#mydiv').hasClass('foo')<\/pre>\n\t\t<p>As would:<\/p>\n\t\t<pre>$('#mydiv').hasClass('bar')<\/pre>\n\t\t<p>While this would return <code>false<\/code>:<\/p>\n\t\t<pre>$('#mydiv').hasClass('quux')<\/pre>","categories":["Attributes","Manipulation > Class Attribute","CSS","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/header-selector\/","name":"header","title":":header Selector","type":"selector","signatures":[{"added":"1.2"}],"desc":"Selects all elements that are headers, like h1, h2, h3 and so on.","longdesc":"<longdesc\/>","categories":["Selectors > Basic Filter","Selectors > jQuery Extensions","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/height\/","name":"height","title":".height()","type":"method","signatures":[{"added":"1.0"}],"desc":"Get the current computed height for the first element in the set of matched elements.","longdesc":"<p>The difference between <code>.css('height')<\/code> and <code>.height()<\/code> is that the latter returns a unit-less pixel value (for example, <code>400<\/code>) while the former returns a value with units intact (for example, <code>400px<\/code>). The <code>.height()<\/code> method is recommended when an element's height needs to be used in a mathematical calculation.<\/p>\n<p class=\"image\"><img src=\"\/images\/0042_04_01.png\"\/><\/p>\n\n<p>This method is also able to find the height of the window and document.<\/p>\n\n<pre>$(window).height();   \/\/ returns height of browser viewport\n$(document).height(); \/\/ returns height of HTML document<\/pre>\n\n<p>Note that <code>.height()<\/code> will always return the content height, regardless of the value of the CSS <code>box-sizing<\/code> property.<\/p>\n\n<blockquote><p><strong>Note:<\/strong> Although <code>style<\/code> and <code>script<\/code> tags will report a value for <code>.width()<\/code> or <code>height()<\/code> when absolutely positioned and given <code>display:block<\/code>, it is strongly discouraged to call those methods on these tags. In addition to being a bad practice, the results may also prove unreliable.<\/p><\/blockquote>\n","categories":["CSS","Dimensions","Manipulation > Style Properties","Version > Version 1.0","Version > Version 1.4.1"],"download":""},{"url":"http:\/\/api.jquery.com\/height\/","name":"height","title":".height()","type":"method","signatures":[{"added":"1.0","params":[{"name":"value","type":"String, Number","optional":"","desc":"An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string)."}]},{"added":"1.4.1","params":[{"name":"function(index, height)","type":"Function","optional":"","desc":"A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, <code>this<\/code> refers to the current element in the set."}]}],"desc":"Set the CSS height of every matched element.","longdesc":"<p>When calling <code>.height(value)<\/code>, the value can be either a string (number and unit) or a number. If only a number is provided for the value, jQuery assumes a pixel unit. If a string is provided, however, a valid CSS measurement must be provided for the height (such as <code>100px<\/code>, <code>50%<\/code>, or <code>auto<\/code>). Note that in modern browsers, the CSS height property does not include padding, border, or margin.<\/p>\n<p>If no explicit unit was specified (like 'em' or '%') then \"px\" is concatenated to the value.<\/p>\n<p>Note that <code>.height(value)<\/code> sets the height of the box in accordance with the CSS <code>box-sizing<\/code> property. Changing this property to <code>border-box<\/code> will cause this function to change the outerHeight of the box instead of the content height.<\/p>","categories":["CSS","Dimensions","Manipulation > Style Properties","Version > Version 1.0","Version > Version 1.4.1"],"download":""},{"url":"http:\/\/api.jquery.com\/hidden-selector\/","name":"hidden","title":":hidden Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements that are hidden.","longdesc":"\n                    <p>Elements can be considered hidden for several reasons:<\/p>\n<ul>\n<li>They have a CSS <code>display<\/code> value of <code>none<\/code>.<\/li>\n<li>They are form elements with <code>type=\"hidden\"<\/code>.<\/li>\n<li>Their width and height are explicitly set to 0.<\/li>\n<li>An ancestor element is hidden, so the element is not shown on the page.<\/li>\n<\/ul>\n<p>Elements with <code>visibility: hidden<\/code> or <code>opacity: 0<\/code> are considered to be visible, since they still consume space in the layout. During animations that hide an element, the element is considered to be visible until the end of the animation. During animations to show an element, the element is considered to be visible at the start of the animation.<\/p>\n<p>How <code>:hidden<\/code> is determined was changed in jQuery 1.3.2. An element is assumed to be hidden if it or any of its parents consumes no space in the document. CSS visibility isn't taken into account (therefore <code>$(elem).css('visibility','hidden').is(':hidden') == false<\/code>). The <a href=\"http:\/\/docs.jquery.com\/Release:jQuery_1.3.2#:visible.2F:hidden_Overhauled\">release notes<\/a> outline the changes in more detail.<\/p>","categories":["Selectors > jQuery Extensions","Version > Version 1.0","Selectors > Visibility Filter"],"download":""},{"url":"http:\/\/api.jquery.com\/hide\/","name":"hide","title":".hide()","type":"method","signatures":[{"added":"1.0"},{"added":"1.0","params":[{"name":"duration","type":"String,Number","optional":"","desc":"A string or number determining how long the animation will run."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.4.3","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]}],"desc":"Hide the matched elements.","longdesc":"\n<p>With no parameters, the <code>.hide()<\/code> method is the simplest way to hide an element:<\/p>\n<pre>$('.target').hide();\n<\/pre>\n<p>The matched elements will be hidden immediately, with no animation. This is roughly equivalent to calling <code>.css('display', 'none')<\/code>, except that the value of the <code>display<\/code> property is saved in jQuery's data cache so that <code>display<\/code> can later be restored to its initial value. If an element has a <code>display<\/code> value of <code>inline<\/code>, then is hidden and shown, it will once again be displayed <code>inline<\/code>.<\/p>\n<p>When a duration is provided, <code>.hide()<\/code> becomes an animation method. The <code>.hide()<\/code> method animates the width, height, and opacity of the matched elements simultaneously. When these properties reach 0, the <code>display<\/code> style property is set to <code>none<\/code> to ensure that the element no longer affects the layout of the page.<\/p>\n<p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively.<\/p>\n<p>Note that <code>.hide()<\/code> is fired immediately and will override the animation queue if no duration or a duration of 0 is specified.<\/p>\n    <p>As of jQuery <strong>1.4.3<\/strong>, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing<\/code>, and one that progresses at a constant pace, called <code>linear<\/code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http:\/\/jqueryui.com\">jQuery UI suite<\/a>.<\/p>\n<p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n<p>We can animate any element, such as a simple image:<\/p>\n<pre>&lt;div id=\"clickme\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \/&gt;\nWith the element initially shown, we can hide it slowly:\n$('#clickme').click(function() {\n  $('#book').hide('slow', function() {\n    alert('Animation complete.');\n  });\n});<\/pre>\n\n<p class=\"image four-across\"> \n  <img src=\"\/images\/0042_06_05.png\" alt=\"\"\/> \n  <img src=\"\/images\/0042_06_06.png\" alt=\"\"\/>\n  <img src=\"\/images\/0042_06_07.png\" alt=\"\"\/>\n  <img src=\"\/images\/0042_06_08.png\" alt=\"\"\/>\n<\/p>\n\n","categories":["Effects > Basics","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/hover\/","name":"hover","title":".hover()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handlerIn(eventObject)","type":"Function","optional":"","desc":"A function to execute when the mouse pointer enters the element."},{"name":"handlerOut(eventObject)","type":"Function","optional":"","desc":"A function to execute when the mouse pointer leaves the element."}]}],"desc":"Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.","longdesc":"\n<p>The <code>.hover()<\/code> method binds handlers for both <code>mouseenter<\/code> and <code>mouseleave<\/code> events. You can use it to simply apply behavior to an element during the time the mouse is within the element.<\/p>\n<p>Calling <code>$(selector).hover(handlerIn, handlerOut)<\/code> is shorthand for:<\/p>\n<pre>$(selector).mouseenter(handlerIn).mouseleave(handlerOut);<\/pre>\n<p>See the discussions for <code><a href=\"\/mouseenter\">.mouseenter()<\/a><\/code> and <code><a href=\"\/mouseleave\">.mouseleave()<\/a><\/code> for more details.<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/hover\/","name":"hover","title":".hover()","type":"method","signatures":[{"added":"1.4","params":[{"name":"handlerInOut(eventObject)","type":"Function","optional":"","desc":"A function to execute when the mouse pointer enters or leaves the element."}]}],"desc":"Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements.","longdesc":"\n<p>The <code>.hover()<\/code> method, when passed a single function, will execute that handler for both <code>mouseenter<\/code> and <code>mouseleave<\/code> events. This allows the user to use jQuery's various toggle methods within the handler or to respond differently within the handler depending on the <code>event.type<\/code>.<\/p>\n<p>Calling <code>$(selector).hover(handlerInOut)<\/code> is shorthand for:<\/p>\n<pre>$(selector).bind(\"mouseenter mouseleave\", handlerInOut);<\/pre>\n<p>See the discussions for <code><a href=\"\/mouseenter\">.mouseenter()<\/a><\/code> and <code><a href=\"\/mouseleave\">.mouseleave()<\/a><\/code> for more details.<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/html\/","name":"html","title":".html()","type":"method","signatures":[{"added":"1.0"}],"desc":"Get the HTML contents of the first element in the set of matched elements.","longdesc":"\n    <p>This method is not available on XML documents.<\/p>\n    <p>In an HTML document, <code>.html()<\/code> can be used to get the contents of any element. If the selector expression matches more than one element, only the first match will have its HTML content returned. Consider this code:<\/p>\n    <pre>$('div.demo-container').html();<\/pre>\n    <p>In order for the following <code>&lt;div&gt;<\/code>'s content to be retrieved, it would have to be the first one with <code>class=\"demo-container\"<\/code> in the document:<\/p>\n    <pre>&lt;div class=\"demo-container\"&gt;\n  &lt;div class=\"demo-box\"&gt;Demonstration Box&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n  <p>The result would look like this:<\/p>\n  <pre>&lt;div class=\"demo-box\"&gt;Demonstration Box&lt;\/div&gt;<\/pre>\n  <p>This method uses the browser's <code>innerHTML<\/code> property. Some browsers may not return HTML that exactly replicates the HTML source in an original document. For example, Internet Explorer sometimes leaves off the quotes around attribute values if they contain only alphanumeric characters.<\/p>\n  ","categories":["Attributes","Manipulation > DOM Insertion"," Inside","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/html\/","name":"html","title":".html()","type":"method","signatures":[{"added":"1.0","params":[{"name":"htmlString","type":"String","optional":"","desc":"A string of HTML to set as the content of each matched element."}]},{"added":"1.4","params":[{"name":"function(index, oldhtml)","type":"Function","optional":"","desc":"A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, <code>this<\/code> refers to the current element in the set."}]}],"desc":"Set the HTML contents of each element in the set of matched elements.","longdesc":"\n    <p>The <code>.html()<\/code> method is not available in XML documents. <\/p>\n\t\t\t\t<p>When <code>.html()<\/code> is used to set an element's content, any content that was in that element is completely replaced by the new content. Consider the following HTML:<\/p>\n\t\t\t\t<pre>&lt;div class=\"demo-container\"&gt;\n  &lt;div class=\"demo-box\"&gt;Demonstration Box&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>The content of <code>&lt;div class=\"demo-container\"&gt;<\/code> can be set like this:<\/p>\n\t\t\t\t<pre>$('div.demo-container')\n  .html('&lt;p&gt;All new content. &lt;em&gt;You bet!&lt;\/em&gt;&lt;\/p&gt;');<\/pre>\n\t\t\t\t<p>That line of code will replace everything inside <code>&lt;div class=\"demo-container\"&gt;<\/code>:<\/p>\n\t\t\t\t<pre>&lt;div class=\"demo-container\"&gt;\n  &lt;p&gt;All new content. &lt;em&gt;You bet!&lt;\/em&gt;&lt;\/p&gt;\n&lt;\/div&gt;<\/pre>\n<p>As of jQuery 1.4, the <code>.html()<\/code> method allows the HTML content to be set by passing in a function.<\/p>\n<pre>$('div.demo-container').html(function() {\n  var emph = '&lt;em&gt;' + $('p').length + ' paragraphs!&lt;\/em&gt;';\n  return '&lt;p&gt;All new content for ' + emph + '&lt;\/p&gt;';\n});<\/pre>\n\n<p>Given a document with six paragraphs, this example will set the HTML of <code>&lt;div class=\"demo-container\"&gt;<\/code> to <code>&lt;p&gt;All new content for &lt;em&gt;6 paragraphs!&lt;\/em&gt;&lt;\/p&gt;<\/code>.<\/p>\n\n  <p>This method uses the browser's <code>innerHTML<\/code> property. Some browsers may not generate a DOM that exactly replicates the HTML source provided. For example, Internet Explorer prior to version 8 will convert all <code>href<\/code> properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate <a href=\"http:\/\/code.google.com\/p\/html5shiv\/\">compatibility layer<\/a>.<\/p>\n\n   <p><strong>Note:<\/strong> In Internet Explorer up to and including version 9, setting the text content of an HTML element may corrupt the text nodes of its children that are being removed from the document as a result of the operation. If you are keeping references to these DOM elements and need them to be unchanged, use <code>.empty().html(string)<\/code> instead of <code>.html(string)<\/code> so that the elements are removed from the document before the new string is assigned to the element.<\/p>\n\n","categories":["Attributes","Manipulation > DOM Insertion"," Inside","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/id-selector\/","name":"id","title":"ID Selector (\"#id\")","type":"selector","signatures":[{"added":"1.0","params":[{"name":"id","type":"String","optional":"","desc":"An ID to search for, specified via the id attribute of an element."}]}],"desc":"Selects a single element with the given id attribute. ","longdesc":"\n                   <p>For id selectors, jQuery uses the JavaScript function <code>document.getElementById()<\/code>, which is extremely efficient. When another selector is attached to the id selector, such as <code>h2#pageTitle<\/code>, jQuery performs an additional check before identifying the element as a match.<\/p>\n                   <blockquote><p>As always, remember that as a developer, your time is typically the most valuable resource. Do not focus on optimization of selector speed unless it is clear that performance needs to be improved.<\/p><\/blockquote>\n                   <p>Each <code>id<\/code> value must be used only once within a document. If more than one element has been assigned the same ID, queries that use that ID will only select the first matched element in the DOM. This behavior should not be relied on, however; a document with more than one element using the same ID is invalid.<\/p>\n                <p>If the id contains characters like periods or colons you have to <a href=\"http:\/\/docs.jquery.com\/Frequently_Asked_Questions#How_do_I_select_an_element_by_an_ID_that_has_characters_used_in_CSS_notation.3F\">escape those characters with backslashes<\/a>.<\/p>\n                ","categories":["Selectors > Basic","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/image-selector\/","name":"image","title":":image Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements of type image.","longdesc":"<p><code>:image<\/code> is equivalent to <code>[type=\"image\"]<\/code><\/p>","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/index\/","name":"index","title":".index()","type":"method","signatures":[{"added":"1.4"},{"added":"1.4","params":[{"name":"selector","type":"Selector","optional":"","desc":"A selector representing a jQuery collection in which to look for an element."}]},{"added":"1.0","params":[{"name":"element","type":"Element, jQuery","optional":"","desc":"The DOM element or first element within the jQuery object to look for."}]}],"desc":"Search for a given element from among the matched elements.","longdesc":"<h4>Return Values<\/h4>\n<p>If no argument is passed to the <code>.index()<\/code> method, the return value is an integer indicating the position of the first element within the jQuery object relative to its sibling elements.<\/p>\n<p>If <code>.index()<\/code> is called on a collection of elements and a DOM element or jQuery object is passed in, <code>.index()<\/code> returns an integer indicating the position of the passed element relative to the original collection.<\/p>\n<p>If a selector string is passed as an argument, <code>.index()<\/code> returns an integer indicating the position of the original element relative to the elements matched by the selector. If the element is not found, <code>.index()<\/code> will return -1.<\/p>\n<h4>Detail<\/h4>\n<p>The complementary operation to <code>.get()<\/code>, which accepts an index and returns a DOM node, <code>.index()<\/code> can take a DOM node and returns an index. Suppose we have a simple unordered list on the page:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li id=\"foo\"&gt;foo&lt;\/li&gt;\n  &lt;li id=\"bar\"&gt;bar&lt;\/li&gt;\n  &lt;li id=\"baz\"&gt;baz&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>If we retrieve one of the three list items (for example, through a DOM function or as the context to an event handler), <code>.index()<\/code> can search for this list item within the set of matched elements:<\/p>\n<pre>\nvar listItem = document.getElementById('bar');\nalert('Index: ' + $('li').index(listItem));\nWe get back the zero-based position of the list item:\n<\/pre>\n<p><span class=\"output\">Index: 1<\/span><\/p>\n<p>Similarly, if we retrieve a jQuery object consisting of one of the three list items, <code>.index()<\/code> will search for that list item:<\/p>\n<pre>\nvar listItem = $('#bar');\nalert('Index: ' + $('li').index(listItem));\n<\/pre>\n<p>We get back the zero-based position of the list item:<\/p>\n<p><span class=\"output\">Index: 1<\/span><\/p>\n<p>Note that if the jQuery collection used as the <code>.index()<\/code> method's argument contains more than one element, the first element within the matched set of elements will be used.<\/p>\n<pre>\nvar listItems = $('li:gt(0)');\nalert('Index: ' + $('li').index(listItems));\n<\/pre>\n<p>We get back the zero-based position of the first list item within the matched set:<\/p>\n<p><span class=\"output\">Index: 1<\/span><\/p>\n<p>If we use a string as the <code>.index()<\/code> method's argument, it is interpreted as a jQuery selector string. The first element among the object's matched elements which also matches this selector is located.<\/p>\n<pre>\nvar listItem = $('#bar');\nalert('Index: ' + listItem.index('li'));\n<\/pre>\n<p>We get back the zero-based position of the list item:<\/p>\n<p><span class=\"output\">Index: 1<\/span><\/p>\n<p>If we omit the argument, <code>.index()<\/code> will return the position of the first element within the set of matched elements in relation to its siblings:<\/p>\n<pre>alert('Index: ' + $('#bar').index();<\/pre>\n<p>Again, we get back the zero-based position of the list item:<\/p>\n<p><span class=\"output\">Index: 1<\/span><\/p>\n\n","categories":["Miscellaneous > DOM Element Methods","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/innerHeight\/","name":"innerHeight","title":".innerHeight()","type":"method","signatures":[{"added":"1.2.6"}],"desc":"Get the current computed height for the first element in the set of matched elements, including padding but not border.","longdesc":"<p>This method returns the height of the element, including top and bottom padding, in pixels.<\/p>\n<p>This method is not applicable to <code>window<\/code> and <code>document<\/code> objects; for these, use <code><a href=\"\/height\">.height()<\/a><\/code> instead.<\/p>\n<p class=\"image\"><img src=\"\/images\/0042_04_02.png\"\/><\/p>","categories":["CSS","Dimensions","Manipulation > Style Properties","Version > Version 1.2.6"],"download":""},{"url":"http:\/\/api.jquery.com\/innerWidth\/","name":"innerWidth","title":".innerWidth()","type":"method","signatures":[{"added":"1.2.6"}],"desc":"Get the current computed width for the first element in the set of matched elements, including padding but not border.","longdesc":"<p>This method returns the width of the element, including left and right padding, in pixels.<\/p>\n<p>This method is not applicable to <code>window<\/code> and <code>document<\/code> objects; for these, use <code><a href=\"\/width\">.width()<\/a><\/code> instead.<\/p>\n<p class=\"image\"><img src=\"\/images\/0042_04_05.png\"\/><\/p>","categories":["CSS","Dimensions","Manipulation > Style Properties","Version > Version 1.2.6"],"download":""},{"url":"http:\/\/api.jquery.com\/input-selector\/","name":"input","title":":input Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all input, textarea, select and button elements.","longdesc":"<p>The <code>:input<\/code> selector basically selects all form controls.<\/p>","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/insertAfter\/","name":"insertAfter","title":".insertAfter()","type":"method","signatures":[{"added":"1.0","params":[{"name":"target","type":"Selector, Element, jQuery","optional":"","desc":"A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter."}]}],"desc":"Insert every element in the set of matched elements after the target.","longdesc":"<p>The <code><a href=\"\/after\">.after()<\/a><\/code> and <code>.insertAfter()<\/code> methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With<code> .after()<\/code>, the selector expression preceding the method is the container after which the content is inserted. With <code>.insertAfter()<\/code>, on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted after the target container.<\/p>\n\t\t\t\t<p>Consider the following HTML:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>We can create content and insert it after several elements at once:<\/p>\n\t\t\t\t<pre>$('&lt;p&gt;Test&lt;\/p&gt;').insertAfter('.inner');<\/pre>\n\t\t\t\t<p>Each inner <code>&lt;div&gt;<\/code> element gets this new content:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;p&gt;Test&lt;\/p&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n  &lt;p&gt;Test&lt;\/p&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>We can also select an element on the page and insert it after another:<\/p>\n\t\t\t\t<pre>$('h2').insertAfter($('.container'));<\/pre>\n\t\t\t\t<p>If an element selected this way is inserted elsewhere, it will be moved after the target (not cloned):<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;\n&lt;h2&gt;Greetings&lt;\/h2&gt;<\/pre>\n\t\t\t\t<p>If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first, and that new set (the original element plus clones) is returned.<\/p>","categories":["Manipulation > DOM Insertion"," Outside","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/insertBefore\/","name":"insertBefore","title":".insertBefore()","type":"method","signatures":[{"added":"1.0","params":[{"name":"target","type":"Selector, Element, jQuery","optional":"","desc":"A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter."}]}],"desc":"Insert every element in the set of matched elements before the target.","longdesc":"<p>The <code><a href=\"\/before\">.before()<\/a><\/code> and <code>.insertBefore()<\/code> methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With<code> .before()<\/code>, the selector expression preceding the method is the container before which the content is inserted. With <code>.insertBefore()<\/code>, on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted before the target container.<\/p>\n\t\t\t\t<p>Consider the following HTML:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>We can create content and insert it before several elements at once:<\/p>\n\t\t\t\t<pre>$('&lt;p&gt;Test&lt;\/p&gt;').insertBefore('.inner');<\/pre>\n\t\t\t\t<p>Each inner <code>&lt;div&gt;<\/code> element gets this new content:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n  &lt;p&gt;Test&lt;\/p&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;p&gt;Test&lt;\/p&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>We can also select an element on the page and insert it before another:<\/p>\n\t\t\t\t<pre>$('h2').insertBefore($('.container'));<\/pre>\n\t\t\t\t<p>If an element selected this way is inserted elsewhere, it will be moved before the target (not cloned):<\/p>\n\t\t\t\t<pre>&lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first, and that new set (the original element plus clones) is returned.<\/p>","categories":["Manipulation > DOM Insertion"," Outside","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/is\/","name":"is","title":".is()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"","desc":"A string containing a selector expression to match elements against."}]},{"added":"1.6","params":[{"name":"function(index)","type":"Function","optional":"","desc":"A function used as a test for the set of elements. It accepts one argument, <code>index<\/code>, which is the element's index in the jQuery collection.Within the function, <code>this<\/code> refers to the current DOM element. "}]},{"added":"1.6","params":[{"name":"jQuery object","type":"Object","optional":"","desc":"An existing jQuery object to match the current set of elements against."}]},{"added":"1.6","params":[{"name":"element","type":"Element","optional":"","desc":"An element to match the current set of elements against."}]}],"desc":"Check the current matched set of elements against a selector, element, or jQuery object and return <code>true<\/code> if at least one of these elements matches the given arguments.","longdesc":"\n<p>Unlike other filtering methods, <code>.is()<\/code> does not create a new jQuery object. Instead, it allows you to test the contents of a jQuery object without modification. This is often useful inside callbacks, such as event handlers.<\/p>\n<p>Suppose you have a list, with two of its items containing a child element:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li&gt;list &lt;strong&gt;item 1&lt;\/strong&gt;&lt;\/li&gt;\n  &lt;li&gt;&lt;span&gt;list item 2&lt;\/span&gt;&lt;\/li&gt;\n  &lt;li&gt;list item 3&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>You can attach a click handler to the &lt;ul&gt; element, and then limit the code to be triggered only when a list item itself, not one of its children, is clicked:<\/p>\n<pre>$(\"ul\").click(function(event) {\n  var $target = $(event.target);\n  if ( $target.is(\"li\") ) {\n    $target.css(\"background-color\", \"red\");\n  }\n});<\/pre>\n<p>Now, when the user clicks on the word \"list\" in the first item or anywhere in the third item, the clicked list item will be given a red background. However, when the user clicks on item 1 in the first item or anywhere in the second item, nothing will occur, because in those cases the target of the event would be <code>&lt;strong&gt;<\/code> or <code>&lt;span&gt;<\/code>, respectively.\n<\/p>\n<p>Prior to jQuery 1.7, in selector strings with positional selectors such as <code>:first<\/code>, <code>:gt()<\/code>, or <code>:even<\/code>, the positional filtering is done against the jQuery object passed to <code>.is()<\/code>, <em>not<\/em> against the containing document. So for the HTML shown above, an expression such as <code>$(\"li:first\").is(\"li:last\")<\/code> returns <code>true<\/code>, but <code>$(\"li:first-child\").is(\"li:last-child\")<\/code> returns <code>false<\/code>. In addition, a bug in Sizzle prevented many positional selectors from working properly. These two factors made positional selectors almost unusable in filters.<\/p>\n\n<p>Starting with jQuery 1.7, selector strings with positional selectors apply the selector against the document, and then determine whether the first element of the current jQuery set matches any of the resulting elements. So for the HTML shown above, an expression such as <code>$(\"li:first\").is(\"li:last\")<\/code> returns <code>false<\/code>. Note that since positional selectors are jQuery additions and not W3C standard, we recommend using the W3C selectors whenever feasible.<\/p>\n\n<h4>Using a Function<\/h4>\n<p>The second form of this method evaluates expressions related to elements based on a function rather than a selector. For each element, if the function returns <code>true<\/code>, <code>.is()<\/code> returns <code>true<\/code> as well. For example, given a somewhat more involved HTML snippet:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li&gt;&lt;strong&gt;list&lt;\/strong&gt; item 1 - one strong tag&lt;\/li&gt;\n  &lt;li&gt;&lt;strong&gt;list&lt;\/strong&gt; item &lt;strong&gt;2&lt;\/strong&gt; -\n    two &lt;span&gt;strong tags&lt;\/span&gt;&lt;\/li&gt;\n  &lt;li&gt;list item 3&lt;\/li&gt;\n  &lt;li&gt;list item 4&lt;\/li&gt;\n  &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>You can attach a click handler to every <code>&lt;li&gt;<\/code> that evaluates the number of <code>&lt;strong&gt;<\/code> elements within the clicked <code>&lt;li&gt;<\/code> at that time like so:<\/p>\n<pre>\n$(\"li\").click(function() {\n  var $li = $(this),\n    isWithTwo = $li.is(function() {\n      return $('strong', this).length === 2;\n    });\n  if ( isWithTwo ) {\n    $li.css(\"background-color\", \"green\");\n  } else {\n    $li.css(\"background-color\", \"red\");\n  }\n});\n<\/pre>\n\n","categories":["Traversing > Filtering","Version > Version 1.0","Version > Version 1.6","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery\/","name":"jQuery","title":"jQuery()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"selector","optional":"","desc":"A string containing a selector expression"},{"name":"context","type":"Element, jQuery","optional":"optional","desc":"A DOM Element, Document, or jQuery to use as context"}]},{"added":"1.0","params":[{"name":"element","type":"Element","optional":"","desc":"A DOM element to wrap in a jQuery object."}]},{"added":"1.0","params":[{"name":"object","type":"Object","optional":"","desc":"A plain object to wrap in a jQuery object."}]},{"added":"1.0","params":[{"name":"elementArray","type":"Array","optional":"","desc":"An array containing a set of DOM elements to wrap in a jQuery object."}]},{"added":"1.0","params":[{"name":"jQuery object","type":"Object","optional":"","desc":"An existing jQuery object to clone."}]},{"added":"1.4"}],"desc":"Accepts a string containing a CSS selector which is then used to match a set of elements.","longdesc":"\n      <p>In the first formulation listed above,  <code>jQuery()<\/code> \u2014 which can also be written as <code>$()<\/code> \u2014 searches through the DOM for any elements that match the provided selector and creates a new jQuery object that references these elements:<\/p>\n<pre>$('div.foo');<\/pre>\n<p>If no elements match the provided selector, the new jQuery object is \"empty\"; that is, it contains no elements and has <code><a href=\"http:\/\/api.jquery.com\/length\/\">.length<\/a><\/code> property of 0.<\/p>\n<h4 id=\"selector-context\">Selector Context<\/h4>\n<p>By default, selectors perform their searches within the DOM starting at the document root. However, an alternate context can be given for the search by using the optional second parameter to the  <code>$()<\/code> function. For example, to do a search within an event handler, the search can be restricted like so:<\/p>\n<pre>\n$('div.foo').click(function() {\n  $('span', this).addClass('bar');\n});\n<\/pre>\n<p>When the search for the span selector is restricted to the context of <code>this<\/code>, only spans within the clicked element will get the additional class.<\/p>\n<p>Internally, selector context is implemented with the <code>.find()<\/code> method, so  <code>$('span', this)<\/code> is equivalent to  <code>$(this).find('span')<\/code>.<\/p>\n<h4 id=\"using-dom-elements\">Using DOM elements<\/h4>\n<p>The second and third formulations of this function create a jQuery object using one or more DOM elements that were already selected in some other way. A common use of this facility is to call jQuery methods on an element that has been passed to a callback function through the keyword <code>this<\/code>:<\/p>\n<pre>\n$('div.foo').click(function() {\n  $(this).slideUp();\n});\n<\/pre>\n<p>This example causes elements to be hidden with a sliding animation when clicked. Because the handler receives the clicked item in the <code>this<\/code> keyword as a bare DOM element, the element must be passed to the <code>$()<\/code> function before applying jQuery methods to it.<\/p>\n<p>XML data returned from an Ajax call can be passed to the <code>$()<\/code> function so individual elements of the XML structure can be retrieved using <code>.find()<\/code> and other DOM traversal methods.<\/p>\n<pre>\n$.post('url.xml', function(data) {\n  var $child = $(data).find('child');\n})\n<\/pre>\n\n<h4 id=\"cloning-jquery-objects\">Cloning jQuery Objects<\/h4>\n<p>When a jQuery object is passed to the <code>$()<\/code> function, a clone of the object is created. This new jQuery object references the same DOM elements as the initial one.<\/p>\n<h4 id=\"returning-empty-set\">Returning an Empty Set<\/h4>\n<p>As of jQuery 1.4, calling the <code>jQuery()<\/code> method with <em>no arguments<\/em> returns an empty jQuery set (with a <code><a href=\"http:\/\/api.jquery.com\/length\/\">.length<\/a><\/code> property of 0). In previous versions of jQuery, this would return a set containing the document node.<\/p>\n\n<h4 id=\"working-with-plain-objects\">Working With Plain Objects<\/h4>\n\n<p>At present, the only operations supported on plain JavaScript objects wrapped in jQuery are: <code>.data()<\/code>,<code>.prop()<\/code>,<code>.bind()<\/code>, <code>.unbind()<\/code>, <code>.trigger()<\/code> and <code>.triggerHandler()<\/code>. The use of <code>.data()<\/code> (or any method requiring <code>.data()<\/code>) on a plain object will result in a new property on the object called jQuery{randomNumber} (eg. jQuery123456789).<\/p>\n\n<pre>\n\/\/ define a plain object\nvar foo = {foo:'bar', hello:'world'};\n\n\/\/ wrap this with jQuery\nvar $foo = $(foo);\n\n\/\/ test accessing property values\nvar test1 = $foo.prop('foo'); \/\/ bar\n\n\/\/ test setting property values\n$foo.prop('foo', 'foobar');\nvar test2 = $foo.prop('foo'); \/\/ foobar\n\n\/\/ test using .data() as summarized above\n$foo.data('keyName', 'someValue');\nconsole.log($foo); \/\/ will now contain a jQuery{randomNumber} property\n\n\/\/ test binding an event name and triggering\n$foo.bind('eventName', function (){\n        console.log('eventName was called');\n});\n\n$foo.trigger('eventName'); \/\/ logs 'eventName was called'\n<\/pre>\n\n<p>Should <code>.trigger('eventName')<\/code> be used, it will search for an 'eventName' property on the object and attempt to execute it after any attached jQuery handlers are executed. It does not check whether the property is a function or not. To avoid this behavior, <code>.triggerHandler('eventName')<\/code> should be used instead.<\/p>\n\n<pre>\n$foo.triggerHandler('eventName'); \/\/ also logs 'eventName was called'\n<\/pre>\n\n","categories":["Core","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery\/","name":"jQuery","title":"jQuery()","type":"method","signatures":[{"added":"1.0","params":[{"name":"html","type":"String","optional":"","desc":"A string of HTML to create on the fly. Note that this parses HTML, <strong>not<\/strong> XML."},{"name":"ownerDocument","type":"document","optional":"optional","desc":"A document in which the new elements will be created"}]},{"added":"1.4","params":[{"name":"html","type":"String","optional":"","desc":"A string defining a single, standalone, HTML element (e.g. &lt;div\/&gt; or &lt;div&gt;&lt;\/div&gt;)."},{"name":"props","type":"Object","optional":"","desc":"An map of attributes, events, and methods to call on the newly-created element."}]}],"desc":"Creates DOM elements on the fly from the provided string of raw HTML.","longdesc":"\n      <h4 id=\"creating-new-elements\">Creating New Elements<\/h4>\n      <p>If a string is passed as the parameter to <code>$()<\/code>, jQuery examines the string to see if it looks like HTML (i.e., it has <code>&lt;tag ... &gt;<\/code> somewhere within the string). If not, the string is interpreted as a selector expression, as explained above. But if the string appears to be an HTML snippet, jQuery attempts to create new DOM elements as described by the HTML. Then a jQuery object is created and returned that refers to these elements. You can perform any of the usual jQuery methods on this object:<\/p>\n      <pre>$('&lt;p id=\"test\"&gt;My &lt;em&gt;new&lt;\/em&gt; text&lt;\/p&gt;').appendTo('body');<\/pre>\n      <p>If the HTML is more complex than a single tag without attributes, as it is in the above example, the actual creation of the elements is handled by the browser's <code>innerHTML<\/code> mechanism. In most cases, jQuery creates a new &lt;div&gt; element and sets the innerHTML property of the element to the HTML snippet that was passed in. When the parameter has a single tag, such as  <code>$('&lt;img\u00a0\/&gt;')<\/code> or  <code>$('&lt;a&gt;&lt;\/a&gt;')<\/code>, jQuery creates the element using the native JavaScript <code>createElement()<\/code> function.<\/p>\n\n<p>When passing in complex HTML, some browsers may not generate a DOM that exactly replicates the HTML source provided. As mentioned, we use the browser's <code>.innerHTML<\/code> property to parse the passed HTML and insert it into the current document. During this process, some  browsers filter out certain elements such as  <code>&lt;html&gt;<\/code>,  <code>&lt;title&gt;<\/code>, or  <code>&lt;head&gt;<\/code> elements. As a result, the  elements inserted may not be representative of the original string  passed.<\/p><p> Filtering isn't however just limited to these tags. For example, Internet Explorer prior to version 8 will also convert all <code>href<\/code> properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate <a href=\"http:\/\/code.google.com\/p\/html5shiv\/\">compatibility layer<\/a>.<\/p>\n\n      <p>To ensure cross-platform compatibility, the snippet must be well-formed. Tags that can contain other elements should be paired with a closing tag:<\/p>\n      <pre>$('&lt;a href=\"http:\/\/jquery.com\"&gt;&lt;\/a&gt;');<\/pre>\n      <p>Alternatively, jQuery allows XML-like tag syntax (with or without a space before the slash):<\/p>\n      <pre>$('&lt;a\/&gt;');<\/pre>\n      <p>Tags that cannot contain elements may be quick-closed or not:<\/p>\n      <pre>$('&lt;img \/&gt;');\n$('&lt;input&gt;');\n<\/pre>\n\n<p>When passing HTML to <code>jQuery()<\/code>, please also note that text nodes are not treated as DOM elements. With the exception of a few methods (such as <code>.content()<\/code>), they are generally otherwise ignored or removed. E.g:<\/p>\n\n<pre>\nvar el = $('1&lt;br\/&gt;2&lt;br\/&gt;3'); \/\/ returns [&lt;br&gt;, \"2\", &lt;br&gt;] \nel  = $('1&lt;br\/&gt;2&lt;br\/&gt;3 &gt;'); \/\/ returns [&lt;br&gt;, \"2\", &lt;br&gt;, \"3 &amp;gt;\"]\n<\/pre>\n\n<p>This behaviour is expected. <\/p>\n\n<p>As of jQuery 1.4, the second argument to <code>jQuery()<\/code> can accept a map consisting of a superset of the properties that can be passed to the <a href=\"\/attr\">.attr()<\/a> method. Furthermore, any <a href=\"\/category\/events\/\">event type<\/a> can be passed in, and the following jQuery methods can be called: <a href=\"\/val\">val<\/a>, <a href=\"\/css\">css<\/a>, <a href=\"\/html\">html<\/a>, <a href=\"\/text\">text<\/a>, <a href=\"\/data\">data<\/a>, <a href=\"\/width\">width<\/a>, <a href=\"\/height\">height<\/a>, or <a href=\"\/offset\">offset<\/a>. The name <code>\"class\"<\/code> must be quoted in the map since it is a JavaScript reserved word, and <code>\"className\"<\/code> cannot be used since it is not the correct attribute name. <\/p>\n<p><strong>Note:<\/strong> Internet Explorer will not allow you to create an <code>input<\/code> or <code>button<\/code> element and change its type; you must specify the type using <code>'&lt;input type=\"checkbox\" \/&gt;'<\/code> for example. A demonstration of this can be seen below:<\/p>\n<p>Unsupported in IE:<\/p>\n<pre>\n$('&lt;input \/&gt;', {\n    type: 'text',\n    name: 'test'\n}).appendTo(\"body\");\n<\/pre>\n<p>Supported workaround:<\/p>\n<pre>\n$('&lt;input type=\"text\" \/&gt;').attr({\n    name: 'test'\n}).appendTo(\"body\");\n<\/pre>\n    ","categories":["Core","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery\/","name":"jQuery","title":"jQuery()","type":"method","signatures":[{"added":"1.0","params":[{"name":"callback","type":"Function","optional":"","desc":"The function to execute when the DOM is ready."}]}],"desc":"Binds a function to be executed when the DOM has finished loading.","longdesc":"\n    <p>This function behaves just like <code>$(document).ready()<\/code>, in that it should be used to wrap other <code>$()<\/code> operations on your page that depend on the DOM being ready. While this function is, technically, chainable, there really isn't much use for chaining against it.<\/p> \n  ","categories":["Core","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jquery-2\/","name":"jquery","title":".jquery","type":"property","signatures":[{"added":"1.0"}],"desc":"A string containing the jQuery version number.","longdesc":"<p>The <code>.jquery<\/code> property is assigned to the jQuery prototype, commonly referred to by its alias <code>$.fn<\/code>. It is a string containing the version number of <code>jQuery<\/code>, such as \"1.5.0\" or \"1.4.4\".<\/p>\n   ","categories":["Internals","Properties > Properties of jQuery Object Instances"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.ajax\/","name":"jQuery.ajax","title":"jQuery.ajax()","type":"method","signatures":[{"added":"1.5","params":[{"name":"url","type":"String","optional":"","desc":"A string containing the URL to which the request is sent."},{"name":"settings","type":"Map","optional":"optional","desc":"A set of key\/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with <a href=\"\/jQuery.ajaxSetup\">$.ajaxSetup()<\/a>. See <a href=\"#jQuery-ajax-settings\">jQuery.ajax( settings )<\/a> below for a complete list of all settings. "}]},{"added":"1.0","params":[{"name":"settings","type":"Map","optional":"","desc":"A set of key\/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with <a href=\"\/jQuery.ajaxSetup\">$.ajaxSetup()<\/a>.","options":[{"name":"accepts","type":"Map","default":"depends on DataType","desc":"The content type sent in the request header that tells the server what kind of response it will accept in return. If the <code>accepts<\/code> setting needs modification, it is recommended to do so once in the <code>$.ajaxSetup()<\/code> method."},{"name":"async","type":"Boolean","default":"true","desc":"By default, all requests are sent asynchronously (i.e. this is set to <code>true<\/code> by default). If you need synchronous requests, set this option to <code>false<\/code>. Cross-domain requests and <code>dataType: \"jsonp\"<\/code> requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active."},{"name":"beforeSend(jqXHR, settings)","type":"Function","default":"","desc":"A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings maps are passed as arguments. This is an <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Event<\/a>. Returning <code>false<\/code> in the <code>beforeSend<\/code> function will cancel the request. <strong>As of jQuery 1.5<\/strong>, the <code>beforeSend<\/code> option will be called regardless of the type of request."},{"name":"cache","type":"Boolean","default":"true, false for dataType 'script' and 'jsonp'","desc":"If set to <code>false<\/code>, it will force requested pages not to be cached by the browser. Setting cache to <code>false<\/code> also appends a query string parameter, \"_=[TIMESTAMP]\", to the URL. "},{"name":"complete(jqXHR, textStatus)","type":"Function, Array","default":"","desc":"A function to be called when the request finishes (after <code>success<\/code> and <code>error<\/code> callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request (<code>\"success\"<\/code>, <code>\"notmodified\"<\/code>, <code>\"error\"<\/code>, <code>\"timeout\"<\/code>, <code>\"abort\"<\/code>, or <code>\"parsererror\"<\/code>). <strong>As of jQuery 1.5<\/strong>, the <code>complete<\/code> setting can accept an array of functions. Each function will be called in turn. This is an <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Event<\/a>."},{"name":"contents","type":"Map","default":"","desc":"A map of string\/regular-expression pairs that determine how jQuery will parse the response, given its content type."},{"name":"contentType","type":"String","default":"'application\/x-www-form-urlencoded'","desc":"When sending data to the server, use this content-type. Default is \"application\/x-www-form-urlencoded\", which is fine for most cases. If you explicitly pass in a content-type to <code>$.ajax()<\/code> then it'll always be sent to the server (even if no data is sent). Data will always be transmitted to the server using UTF-8 charset; you must decode this appropriately on the server side."},{"name":"context","type":"Object","default":"","desc":"This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call (<code>$.ajaxSettings<\/code> merged with the settings passed to <code>$.ajax<\/code>). For example,  specifying a DOM element as the context will make that the context for the <code>complete<\/code> callback of a request, like so: <pre>$.ajax({\n  url: \"test.html\",\n  context: document.body\n}).done(function() { \n  $(this).addClass(\"done\");\n});<\/pre>"},{"name":"converters","type":"Map","default":"{\"* text\": window.String, \"text html\": true, \"text json\": jQuery.parseJSON, \"text xml\": jQuery.parseXML}","desc":"A map of dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response."},{"name":"crossDomain","type":"Boolean","default":"false for same-domain requests, true for cross-domain requests","desc":"If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to <code>true<\/code>. This allows, for example, server-side redirection to another domain."},{"name":"data","type":"Object, String","default":"","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 <code>processData<\/code> option to prevent this automatic processing. Object must be Key\/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the <code>traditional<\/code> setting (described below)."},{"name":"dataFilter(data, type)","type":"Function","default":"","desc":"A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter."},{"name":"dataType","type":"String","default":"Intelligent Guess (xml, json, script, or html)","desc":"The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). The available types (and the result passed as the first argument to your success callback) are:\n          <ul>\n            <li>\"xml\": Returns a XML document that can be processed via jQuery.<\/li>\n            <li>\"html\": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM.<\/li>\n            <li>\"script\": Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, \"_=[TIMESTAMP]\", to the URL unless the <code>cache<\/code> option is set to <code>true<\/code>. <strong>Note:<\/strong> This will turn POSTs into GETs for remote-domain requests. <\/li>\n            <li>\"json\": Evaluates the response as JSON and returns a JavaScript object. In jQuery 1.4 the JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. (See <a href=\"http:\/\/json.org\/\">json.org<\/a> for more information on proper JSON formatting.)<\/li>\n            <li>\"jsonp\": Loads in a JSON block using <a href=\"http:\/\/bob.pythonmac.org\/archives\/2005\/12\/05\/remote-json-jsonp\/\">JSONP<\/a>. Adds an extra \"?callback=?\" to the end of your URL to specify the callback. Disables caching by appending a query string parameter, \"_=[TIMESTAMP]\", to the URL unless the <code>cache<\/code> option is set to <code>true<\/code>.<\/li>\n            <li>\"text\": A plain text string.<\/li>\n            <li>multiple, space-separated values: <strong>As of jQuery 1.5<\/strong>, jQuery can convert a dataType from what it received in the Content-Type header to what you require. For example, if you want a text response to be treated as XML, use \"text xml\" for the dataType. You can also make a JSONP request, have it received as text, and interpreted by jQuery as XML: \"jsonp text xml.\" Similarly, a shorthand string such as \"jsonp xml\" will first attempt to convert from jsonp to xml, and, failing that, convert from jsonp to text, and then from text to xml.\n            <\/li>\n          <\/ul>"},{"name":"error(jqXHR, textStatus, errorThrown)","type":"Function","default":"","desc":"A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides <code>null<\/code>) are <code>\"timeout\"<\/code>, <code>\"error\"<\/code>, <code>\"abort\"<\/code>, and <code>\"parsererror\"<\/code>. When an HTTP error occurs, <code>errorThrown<\/code> receives the textual portion of the HTTP status, such as \"Not Found\" or \"Internal Server Error.\"  <strong>As of jQuery 1.5<\/strong>, the <code>error<\/code> setting can accept an array of functions. Each function will be called in turn.  <strong>Note:<\/strong> <em>This handler is not called for cross-domain script and JSONP requests.<\/em> This is an <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Event<\/a>. "},{"name":"global","type":"Boolean","default":"true","desc":"Whether to trigger global Ajax event handlers for this request. The default is <code>true<\/code>. Set to <code>false<\/code> to prevent the global handlers like <code>ajaxStart<\/code> or <code>ajaxStop<\/code> from being triggered. This can be used to control various <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Events<\/a>."},{"name":"headers","type":"Map","default":"{}","desc":"A map of additional header key\/value pairs to send along with the request. This setting is set before the <code>beforeSend<\/code> function is called; therefore, any values in the headers setting can be overwritten from within the <code>beforeSend<\/code> function."},{"name":"ifModified","type":"Boolean","default":"false","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 <code>false<\/code>, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data."},{"name":"isLocal","type":"Boolean","default":"depends on current location protocol","desc":"Allow the current environment to be recognized as \"local,\" (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: <code>file<\/code>, <code>*-extension<\/code>, and <code>widget<\/code>. If the <code>isLocal<\/code> setting needs modification, it is recommended to do so once in the <code>$.ajaxSetup()<\/code> method.  "},{"name":"jsonp","type":"String","default":"","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.  So <code>{jsonp:'onJSONPLoad'}<\/code> would result in <code>'onJSONPLoad=?'<\/code> passed to the server. <strong>As of jQuery 1.5<\/strong>, setting the <code>jsonp<\/code> option to <code>false<\/code> prevents jQuery from adding the \"?callback\" string to the URL or attempting to use \"=?\" for transformation. In this case, you should also explicitly set the <code>jsonpCallback<\/code> setting. For example, <code>{ jsonp: false, jsonpCallback: \"callbackName\" }<\/code>"},{"name":"jsonpCallback","type":"String, Function","default":"","desc":"Specify the callback function name for a JSONP request.  This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. <strong>As of jQuery 1.5<\/strong>, you can also use a function for this setting, in which case the value of <code>jsonpCallback<\/code> is set to the return value of that function. "},{"name":"mimeType","type":"String","default":"","desc":"A mime type to override the <abbr title=\"XMLHttpRequest\">XHR<\/abbr> mime type."},{"name":"password","type":"String","default":"","desc":"A password to be used in response to an HTTP access authentication request."},{"name":"processData","type":"Boolean","default":"true","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 \"application\/x-www-form-urlencoded\". If you want to send a DOMDocument, or other non-processed data, set this option to <code>false<\/code>."},{"name":"scriptCharset","type":"String","default":"","desc":"Only for requests with \"jsonp\" or \"script\" dataType and \"GET\" type. Forces the request to be interpreted as a certain charset. Only needed for charset differences between the remote and local content."},{"name":"statusCode","type":"Map","default":"{}","desc":"\n            <p>A map of numeric HTTP codes and functions to be called when the response has the corresponding code. For example, the following will alert when the response status is a 404:<\/p>\n<pre>$.ajax({\n  statusCode: {\n    404: function() {\n      alert(\"page not found\");\n    }\n  }\n});<\/pre>\n            <p>If the request is successful, the status code functions take the same parameters as the success callback; if it results in an error, they take the same parameters as the <code>error<\/code> callback.<\/p>\n          "},{"name":"success(data, textStatus, jqXHR)","type":"Function, Array","default":"","desc":"A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the <code>dataType<\/code> parameter; a string describing the status; and the <code>jqXHR<\/code> (in jQuery 1.4.x, XMLHttpRequest) object. <strong>As of jQuery 1.5<\/strong>, <em>the success setting can accept an array of functions. Each function will be called in turn.<\/em> This is an <a href=\"http:\/\/docs.jquery.com\/Ajax_Events\">Ajax Event<\/a>."},{"name":"timeout","type":"Number","default":"","desc":"Set a timeout (in milliseconds) for the request. This will override any global timeout set with <a href=\"http:\/\/api.jquery.com\/jQuery.ajaxSetup\">$.ajaxSetup()<\/a>. The timeout period starts at the point the <code>$.ajax<\/code> call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. <strong>In jQuery 1.4.x and below,<\/strong> the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. <strong>In Firefox 3.0+ only,<\/strong> script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period."},{"name":"traditional","type":"Boolean","default":"","desc":"Set this to <code>true<\/code> if you wish to use the traditional style of <a href=\"\/jQuery.param\">param serialization<\/a>."},{"name":"type","type":"String","default":"'GET'","desc":"The type of request to make (\"POST\" or \"GET\"), default is \"GET\". <strong>Note:<\/strong> Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers."},{"name":"url","type":"String","default":"The current page","desc":" A string containing the URL to which the request is sent."},{"name":"username","type":"String","default":"","desc":"A username to be used in response to an HTTP access authentication request."},{"name":"xhr","type":"Function","default":"ActiveXObject when available (IE), the XMLHttpRequest otherwise","desc":"Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory."},{"name":"xhrFields","type":"Map","default":"","desc":"<p>A map of fieldName-fieldValue pairs to set on the native <code><abbr title=\"XMLHttpRequest\">XHR<\/abbr><\/code> object. For example, you can use it to set <code>withCredentials<\/code> to <code>true<\/code> for cross-domain requests if needed.\n<pre>$.ajax({\n   url: a_cross_domain_url,\n   xhrFields: {\n      withCredentials: true\n   }\n});<\/pre>\n<p>\n<strong>In jQuery 1.5<\/strong>, the <code>withCredentials<\/code> property was not propagated to the native <code>XHR<\/code> and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it.\n<\/p>\n<\/p>"}]}]}],"desc":"Perform an asynchronous HTTP (Ajax) request.","longdesc":"\n      <p>The <code>$.ajax()<\/code> function underlies all Ajax requests sent by jQuery.  It is often unnecessary to directly call this function, as several higher-level alternatives like <code><a href=\"\/jQuery.get\">$.get()<\/a><\/code> and <code><a href=\"\/load\">.load()<\/a><\/code> are available and are easier to use. If less common options are required, though, <code>$.ajax()<\/code> can be used more flexibly.<\/p>\n      <p>At its simplest, the <code>$.ajax()<\/code> function can be called with no arguments:<\/p>\n      <pre>$.ajax();<\/pre>\n\n      <p><strong>Note:<\/strong> Default settings can be set globally by using the <code><a href=\"\/jQuery.ajaxSetup\">$.ajaxSetup()<\/a><\/code> function.<\/p>\n\n      <p>This example, using no options, loads the contents of the current page, but does nothing with the result. To use the result, we can implement one of the callback functions.<\/p>\n\n      <h4 id=\"jqXHR\">The jqXHR Object<\/h4>\n      <p>The jQuery XMLHttpRequest (jqXHR) object returned by <code>$.ajax()<\/code> <strong>as of jQuery 1.5<\/strong> is a superset of the browser's native XMLHttpRequest object. For example, it contains <code>responseText<\/code> and <code>responseXML<\/code> properties, as well as a <code>getResponseHeader()<\/code> method. When the transport mechanism is something other than XMLHttpRequest (for example, a script tag for a JSONP request) the <code>jqXHR<\/code> object simulates native XHR functionality where possible. <\/p>\n     <p><strong>As of jQuery 1.5.1<\/strong>, the <code>jqXHR<\/code> object also contains the <code>overrideMimeType()<\/code> method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). The <code>.overrideMimeType()<\/code> method may be used in the <code>beforeSend()<\/code> callback function, for example, to modify the response content-type header:<\/p>\n<pre>\n$.ajax({\n  url: \"http:\/\/fiddle.jshell.net\/favicon.png\",\n  beforeSend: function ( xhr ) {\n    xhr.overrideMimeType(\"text\/plain; charset=x-user-defined\");\n  }\n}).done(function ( data ) {\n  if( console &amp;&amp; console.log ) {\n    console.log(\"Sample of data:\", data.slice(0, 100));\n  }\n});\n<\/pre>\n\n    <p>The jqXHR objects returned by <code>$.ajax()<\/code> as of jQuery 1.5 implement the Promise interface, giving them all the properties, methods, and behavior of a Promise (see <a href=\"http:\/\/api.jquery.com\/category\/deferred-object\/\">Deferred object<\/a> for more information).  For convenience and consistency with the callback names used by <code>$.ajax()<\/code>, jqXHR also provides <code>.error()<\/code>, <code>.success()<\/code>, and <code>.complete()<\/code> methods. These methods take a function argument that is called when the <code>$.ajax()<\/code> request terminates, and the function receives the same arguments as the correspondingly-named <code>$.ajax()<\/code> callback. This allows you to assign multiple callbacks on a single request, and even to assign callbacks after the request may have completed. (If the request is already complete, the callback is fired immediately.)<\/p>\n    <blockquote>\n      <p><strong>Deprecation Notice:<\/strong> The <code>jqXHR.success()<\/code>, <code>jqXHR.error()<\/code>, and <code>jqXHR.complete()<\/code> callbacks will be deprecated in jQuery 1.8. To prepare your code for their eventual removal, use <code>jqXHR.done()<\/code>, <code>jqXHR.fail()<\/code>, and <code>jqXHR.always()<\/code> instead.<\/p>\n    <\/blockquote>\n<pre>\/\/ Assign handlers immediately after making the request,\n\/\/ and remember the jqxhr object for this request\nvar jqxhr = $.ajax( \"example.php\" )\n    .done(function() { alert(\"success\"); })\n    .fail(function() { alert(\"error\"); })\n    .always(function() { alert(\"complete\"); });\n\n\/\/ perform other work here ...\n\n\/\/ Set another completion function for the request above\njqxhr.always(function() { alert(\"second complete\"); });<\/pre>\n\n      <p>For backward compatibility with <code>XMLHttpRequest<\/code>, a <code>jqXHR<\/code> object will expose the following properties and methods:<\/p>\n      <ul>\n        <li><code>readyState<\/code><\/li>\n        <li><code>status<\/code><\/li>\n        <li><code>statusText<\/code><\/li>\n        <li><code>responseXML<\/code> and\/or <code>responseText<\/code> when the underlying request responded with xml and\/or text, respectively<\/li>\n        <li><code>setRequestHeader(name, value)<\/code> which departs from the standard by replacing the old value with the new one rather than concatenating the new value to the old one<\/li>\n        <li><code>getAllResponseHeaders()<\/code><\/li>\n        <li><code>getResponseHeader()<\/code><\/li>\n        <li><code>abort()<\/code><\/li>\n      <\/ul>\n\n      <p>No <code>onreadystatechange<\/code> mechanism is provided, however, since <code>success<\/code>, <code>error<\/code>, <code>complete<\/code> and <code>statusCode<\/code> cover all conceivable requirements.<\/p>\n\n      <h4 id=\"callback-functions\">Callback Function Queues<\/h4>\n      <p>The <code>beforeSend<\/code>, <code>error<\/code>, <code>dataFilter<\/code>, <code>success<\/code> and <code>complete<\/code> options all accept callback functions that are invoked at the appropriate times.<\/p>\n\n      <p><strong>As of jQuery 1.5<\/strong>, the <code>error<\/code> (<code>fail<\/code>), <code>success<\/code> (<code>done<\/code>), and <code>complete<\/code> (<code>always<\/code>, as of jQuery 1.6) callback hooks are first-in, first-out managed queues. This means you can assign more than one callback for each hook. See <a href=\"http:\/\/api.jquery.com\/category\/deferred-object\/\">Deferred object methods<\/a>, which are implemented internally for these <code>$.ajax()<\/code> callback hooks.<\/p>\n\n      <p>The <code>this<\/code> reference within all callbacks is the object in the <code>context<\/code> option passed to <code>$.ajax<\/code> in the settings; if <code>context<\/code> is not specified, <code>this<\/code> is a reference to the Ajax settings themselves.<\/p>\n\n      <p>Some types of Ajax requests, such as JSONP and cross-domain GET requests, do not use XHR; in those cases the <code>XMLHttpRequest<\/code> and <code>textStatus<\/code> parameters passed to the callback are <code>undefined<\/code>.<\/p>\n\n      <p>Here are the callback hooks provided by <code>$.ajax()<\/code>:<\/p>\n      <ol>\n        <li><code>beforeSend<\/code> callback is invoked; it receives the <code>jqXHR<\/code> object and the <code>settings<\/code> map as parameters.<\/li>\n        <li><code>error<\/code> callbacks are invoked, in the order they are registered, if the request fails. They receive the <code>jqXHR<\/code>, a string indicating the error type, and an exception object if applicable. Some built-in errors will provide a string as the exception object: \"abort\", \"timeout\", \"No Transport\".<\/li>\n        <li><code>dataFilter<\/code> callback is invoked immediately upon successful receipt of response data. It receives the returned data and the value of <code>dataType<\/code>, and must return the (possibly altered) data to pass on to <code>success<\/code>.<\/li>\n        <li><code>success<\/code> callbacks are then invoked, in the order they are registered, if the request succeeds. They receive the returned data, a string containing the success code, and the <code>jqXHR<\/code> object.<\/li>\n        <li><code>complete<\/code> callbacks fire, in the order they are registered, when the request finishes, whether in failure or success. They receive the <code>jqXHR<\/code> object, as well as a string containing the success or error code.<\/li>\n      <\/ol>\n      <p>For example, to make use of the returned HTML, we can implement a <code>success<\/code> handler:<\/p>\n<pre>$.ajax({\n  url: 'ajax\/test.html',\n  success: function(data) {\n    $('.result').html(data);\n    alert('Load was performed.');\n  }\n});<\/pre>\n\n      <h4 id=\"data-types\">Data Types<\/h4>\n      <p>The <code>$.ajax()<\/code> function relies on the server to provide information about the retrieved data. If the server reports the return data as XML, the result can be traversed using normal XML methods or jQuery's selectors. If another type is detected, such as HTML in the example above, the data is treated as text.<\/p>\n      <p>Different data handling can be achieved by using the <code>dataType<\/code> option. Besides plain <code>xml<\/code>, the <code>dataType<\/code> can be <code>html<\/code>, <code>json<\/code>, <code>jsonp<\/code>, <code>script<\/code>, or <code>text<\/code>.<\/p>\n      <p>The <code>text<\/code> and <code>xml<\/code> types return the data with no processing. The data is simply passed on to the success handler, either through the <code>responseText<\/code> or <code>responseXML<\/code> property of the <code>jqXHR<\/code> object, respectively.<\/p>\n      <p><strong>Note:<\/strong> We must ensure that the MIME type reported by the web server matches our choice of <code>dataType<\/code>. In particular, XML must be declared by the server as <code>text\/xml<\/code> or <code>application\/xml<\/code> for consistent results.<\/p>\n      <p>If <code>html<\/code> is specified, any embedded JavaScript inside the retrieved data is executed before the HTML is returned as a string. Similarly, <code>script<\/code> will execute the JavaScript that is pulled back from the server, then return nothing.<\/p>\n      <p>The <code>json<\/code> type parses the fetched data file as a JavaScript object and returns the constructed object as the result data. To do so, it uses <code>jQuery.parseJSON()<\/code> when the browser supports it; otherwise it uses a <code>Function<\/code> <strong>constructor<\/strong>. Malformed JSON data will throw a parse error (see <a href=\"http:\/\/json.org\/\">json.org<\/a> for more information). JSON data is convenient for communicating structured data in a way that is concise and easy for JavaScript to parse. If the fetched data file exists on a remote server, specify the <code>jsonp<\/code> type instead.<\/p>\n      <p>The <code>jsonp<\/code> type appends a query string parameter of <code>callback=?<\/code> to the URL. The server should prepend the JSON data with the callback name to form a valid JSONP response. We can specify a parameter name other than <code>callback<\/code> with the <code>jsonp<\/code> option to <code>$.ajax()<\/code>.<\/p>\n      <p><strong>Note:<\/strong> JSONP is an extension of the JSON format, requiring some server-side code to detect and handle the query string parameter. More information about it can be found in the <a href=\"http:\/\/bob.pythonmac.org\/archives\/2005\/12\/05\/remote-json-jsonp\/\">original post detailing its use<\/a>.<\/p>\n      <p>When data is retrieved from remote servers (which is only possible using the <code>script<\/code> or <code>jsonp<\/code> data types), the <code>error<\/code> callbacks and global events will never be fired.<\/p>\n\n          <h4 id=\"sending-data-to-server\">Sending Data to the Server<\/h4>\n          <p>By default, Ajax requests are sent using the GET HTTP method. If the POST method is required, the method can be specified by setting a value for the <code>type<\/code> option. This option affects how the contents of the <code>data<\/code> option are sent to the server. POST data will always be transmitted to the server using UTF-8 charset, per the W3C XMLHTTPRequest standard.<\/p>\n          <p>The <code>data<\/code> option can contain either a query string of the form <code>key1=value1&amp;key2=value2<\/code>, or a map of the form <code>{key1: 'value1', key2: 'value2'}<\/code>. If the latter form is used, the data is converted into a query string using <code><a href=\"http:\/\/api.jquery.com\/jQuery.param\/\">jQuery.param()<\/a><\/code> before it is sent. This processing can be circumvented by setting <code>processData<\/code> to <code>false<\/code>.  The processing might be undesirable if you wish to send an XML object to the server; in this case, change the <code>contentType<\/code> option from <code>application\/x-www-form-urlencoded<\/code> to a more appropriate MIME type.<\/p>\n\n          <h4 id=\"advanced-options\">Advanced Options<\/h4>\n          <p>The <code>global<\/code> option prevents handlers registered using <code><a href=\"\/ajaxSend\">.ajaxSend()<\/a><\/code>, <code><a href=\"\/ajaxError\">.ajaxError()<\/a><\/code>, and similar methods from firing when this request would trigger them. This can be useful to, for example, suppress a loading indicator that was implemented with <code><a href=\"\/ajaxSend\">.ajaxSend()<\/a><\/code> if the requests are frequent and brief. With cross-domain script and JSONP requests, the global option is automatically set to <code>false<\/code>. See the descriptions of these methods below for more details.  See the descriptions of these methods below for more details.<\/p>\n          <p>If the server performs HTTP authentication before providing a response, the user name and password pair can be sent via the <code>username<\/code> and <code>password<\/code> options.<\/p>\n          <p>Ajax requests are time-limited, so errors can be caught and handled to provide a better user experience. Request timeouts are usually either left at their default or set as a global default using <code><a href=\"\/jQuery.ajaxSetup\">$.ajaxSetup()<\/a><\/code> rather than being overridden for specific requests with the <code>timeout<\/code> option.<\/p>\n          <p>By default, requests are always issued, but the browser may serve results out of its cache. To disallow use of the cached results, set <code>cache<\/code> to <code>false<\/code>. To cause the request to report failure if the asset has not been modified since the last request, set <code>ifModified<\/code> to <code>true<\/code>.<\/p>\n          <p>The <code>scriptCharset<\/code> allows the character set to be explicitly specified for requests that use a <code>&lt;script&gt;<\/code> tag (that is, a type of <code>script<\/code> or <code>jsonp<\/code>). This is useful if the script and host page have differing character sets.<\/p>\n          <p>The first letter in Ajax stands for \"asynchronous,\" meaning that the operation occurs in parallel and the order of completion is not guaranteed. The <code>async<\/code> option to <code>$.ajax()<\/code> defaults to <code>true<\/code>, indicating that code execution can continue after the request is made. Setting this option to <code>false<\/code> (and thus making the call no longer asynchronous) is strongly discouraged, as it can cause the browser to become unresponsive.<\/p>\n\n          <p>The <code>$.ajax()<\/code> function returns the <code>XMLHttpRequest<\/code> object that it creates. Normally jQuery handles the creation of this object internally, but a custom function for manufacturing one can be specified using the <code>xhr<\/code> option. The returned object can generally be discarded, but does provide a lower-level interface for observing and manipulating the request. In particular, calling <code>.abort()<\/code> on the object will halt the request before it completes.<\/p>\n<p><strong>At present<\/strong>, due to a bug in Firefox where <code>.getAllResponseHeaders()<\/code> returns the empty string although <code>.getResponseHeader('Content-Type')<\/code> returns a non-empty string, automatically decoding JSON CORS responses in Firefox with jQuery is not supported.<\/p>\n\n<p>A workaround to this is possible by overriding <code>jQuery.ajaxSettings.xhr<\/code> as follows:<\/p>\n\n<pre>\nvar _super = jQuery.ajaxSettings.xhr;\njQuery.ajaxSettings.xhr = function () {\n    var xhr = _super(),\n        getAllResponseHeaders = xhr.getAllResponseHeaders;\n\n    xhr.getAllResponseHeaders = function () {\n        if ( getAllResponseHeaders() ) {\n            return getAllResponseHeaders();\n        }\n        var allHeaders = \"\";\n        $( [\"Cache-Control\", \"Content-Language\", \"Content-Type\",\n                \"Expires\", \"Last-Modified\", \"Pragma\"] ).each(function (i, header_name) {\n\n            if ( xhr.getResponseHeader( header_name ) ) {\n                allHeaders += header_name + \": \" + xhr.getResponseHeader( header_name ) + \"\\n\";\n            }\n            return allHeaders;\n        });\n    };\n    return xhr;\n};\n<\/pre>\n\n <h4>Extending Ajax<\/h4>\n     <p><strong>As of jQuery 1.5<\/strong>, jQuery's Ajax implementation includes prefilters, converters, and transports that allow you to extend Ajax with a great deal of flexibility. For more information about these advanced features, see the <a href=\"http:\/\/api.jquery.com\/extending-ajax\/\">Extending Ajax<\/a> page.<\/p>\n ","categories":["Ajax > Low-Level Interface","Version > Version 1.0","Version > Version 1.5","Version > Version 1.5.1"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.ajaxPrefilter\/","name":"jQuery.ajaxPrefilter","title":"jQuery.ajaxPrefilter()","type":"method","signatures":[{"added":"1.5","params":[{"name":"dataTypes","type":"String","optional":"optional","desc":"An optional string containing one or more space-separated dataTypes"},{"name":"handler(options, originalOptions, jqXHR)","type":"Function","optional":"","desc":"A handler to set default values for future Ajax requests."}]}],"desc":"Handle custom Ajax options or modify existing options before each request is sent and before they are processed by <code>$.ajax()<\/code>.","longdesc":"\n\n<p>A typical prefilter registration using <code>$.ajaxPrefilter()<\/code> looks like this:<\/p>\n\n<pre>\n$.ajaxPrefilter( function( options, originalOptions, jqXHR ) {\n  \/\/ Modify options, control originalOptions, store jqXHR, etc\n});\n<\/pre>\n\n<p>where:<\/p>\n\n<ul>\n<li><code>options<\/code> are the request options<\/li>\n<li><code>originalOptions<\/code> are the options as provided to the ajax method, unmodified and, thus, without defaults from <code>ajaxSettings<\/code><\/li>\n<li><code>jqXHR<\/code> is the jqXHR object of the request<\/li>\n<\/ul>\n\n<p>Prefilters are a perfect fit when custom options need to be handled.  Given the following code, for example, a call to <code>$.ajax()<\/code> would automatically abort a request to the same URL if the custom <code>abortOnRetry<\/code> option is set to <code>true<\/code>:<\/p>\n\n<pre>\nvar currentRequests = {};\n\n$.ajaxPrefilter(function( options, originalOptions, jqXHR ) {\n  if ( options.abortOnRetry ) {\n    if ( currentRequests[ options.url ] ) {\n      currentRequests[ options.url ].abort();\n    }\n    currentRequests[ options.url ] = jqXHR;\n  }\n});\n<\/pre>\n\n<p>Prefilters can also be used to modify existing options. For example, the following proxies cross-domain requests through http:\/\/mydomain.net\/proxy\/:<\/p>\n\n<pre>\n$.ajaxPrefilter( function( options ) {\n  if ( options.crossDomain ) {\n    options.url = \"http:\/\/mydomain.net\/proxy\/\" + encodeURIComponent( options.url );\n    options.crossDomain = false;\n  }\n});\n<\/pre>\n\n<p>If the optional <code>dataTypes<\/code> argument is supplied, the prefilter will be only be applied to requests with the indicated dataTypes. For example, the following only applies the given prefilter to JSON and script requests:<\/p>\n\n<pre>\n$.ajaxPrefilter( \"json script\", function( options, originalOptions, jqXHR ) {\n  \/\/ Modify options, control originalOptions, store jqXHR, etc\n});\n<\/pre>\n\n<p>The <code>$.ajaxPrefilter()<\/code> method can also redirect a request to another dataType by returning that dataType. For example, the following sets a request as \"script\" if the URL has some specific properties defined in a custom <code>isActuallyScript()<\/code> function:<\/p>\n\n<pre>\n$.ajaxPrefilter(function( options ) {\n  if ( isActuallyScript( options.url ) ) {\n    return \"script\";\n  }\n});\n<\/pre>\n\n<p>This would ensure not only that the request is considered \"script\" but also that all the prefilters specifically attached to the script dataType would be applied to it.<\/p>\n  ","categories":["Ajax > Low-Level Interface","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.ajaxSetup\/","name":"jQuery.ajaxSetup","title":"jQuery.ajaxSetup()","type":"method","signatures":[{"added":"1.1","params":[{"name":"options","type":"Options","optional":"","desc":"A set of key\/value pairs that configure the default Ajax request. All options are optional. "}]}],"desc":"Set default values for future Ajax requests.","longdesc":"<p>For details on the settings available for <code>$.ajaxSetup()<\/code>, see <code><a href=\"\/jQuery.ajax\">$.ajax()<\/a><\/code>. <\/p>\n    <p>All subsequent Ajax calls using any function will use the new settings, unless overridden by the individual calls, until the next invocation of <code>$.ajaxSetup()<\/code>.<\/p>\n    <p>For example, the following sets a default for the <code>url<\/code> parameter before pinging the server repeatedly:<\/p>\n<pre>$.ajaxSetup({\n  url: 'ping.php'\n});<\/pre>\n    <p>Now each time an Ajax request is made, the \"ping.php\" URL will be used automatically:<\/p>\n<pre>$.ajax({\n  \/\/ url not set here; uses ping.php\n  data: {'name': 'Dan'}\n});<\/pre>\n\n    <blockquote><p>Note: Global callback functions should be set with their respective global Ajax event handler methods\u2014<code><a href=\"\/ajaxStart\">.ajaxStart()<\/a><\/code>, <code><a href=\"\/ajaxStop\">.ajaxStop()<\/a><\/code>, <code><a href=\"\/ajaxComplete\">.ajaxComplete()<\/a><\/code>, <code><a href=\"\/ajaxError\">.ajaxError()<\/a><\/code>, <code><a href=\"\/ajaxSuccess\">.ajaxSuccess()<\/a><\/code>, <code><a href=\"\/ajaxSend\">.ajaxSend()<\/a><\/code>\u2014rather than within the <code>options<\/code> object for <code>$.ajaxSetup()<\/code>.<\/p><\/blockquote>\n","categories":["Ajax > Low-Level Interface","Version > Version 1.1"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.boxModel\/","name":"jQuery.boxModel","title":"jQuery.boxModel","type":"property","signatures":[{"added":"1.0"}],"desc":"<strong>Deprecated in jQuery 1.3 (see <a href=\"\/jQuery.support\">jQuery.support<\/a>)<\/strong>. States if the current page, in the user's browser, is being rendered using the <a href=\"http:\/\/www.w3.org\/TR\/REC-CSS2\/box.html\">W3C CSS Box Model<\/a>.","longdesc":"<longdesc\/>","categories":["Deprecated","Utilities","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.browser\/","name":"jQuery.browser","title":"jQuery.browser","type":"property","signatures":[{"added":"1.0"}],"desc":"Contains flags for the useragent, read from navigator.userAgent. <strong>We recommend against using this property; please try to use feature detection instead (see jQuery.support). jQuery.browser may be moved to a plugin in a future release of jQuery.<\/strong> ","longdesc":"\n    <p>The <code>$.browser<\/code> property provides information about the web browser that is accessing the page, as reported by the browser itself. It contains flags for each of the four most prevalent browser classes (Internet Explorer, Mozilla, Webkit, and Opera) as well as version information.<\/p>\n\n<p>Available flags are:<\/p>\n<ul>\n  <li>webkit (as of jQuery 1.4)<\/li>\n  <li>safari (deprecated)<\/li>\n  <li>opera<\/li>\n  <li>msie<\/li>\n  <li>mozilla<\/li>\n<\/ul>\n\n<p>This property is available immediately. It is therefore safe to use it to determine whether or not to call <code>$(document).ready()<\/code>.\nThe <code>$.browser<\/code> property is deprecated in jQuery 1.3, and its functionality may be moved to a team-supported plugin in a future release of jQuery.<\/p>\n\n<p>Because <code>$.browser<\/code> uses <code>navigator.userAgent<\/code> to determine the platform, it is vulnerable to spoofing by the user or misrepresentation by the browser itself. It is always best to avoid browser-specific code entirely where possible. The <code><a href=\"http:\/\/api.jquery.com\/jQuery.support\/\">$.support<\/a><\/code> property is available for detection of support for particular features rather than relying on <code>$.browser<\/code>. <\/p>","categories":["Deprecated","Properties > Properties of the Global jQuery Object","Utilities","Version > Version 1.0","Version > Version 1.1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.browser\/","name":"jQuery.browser.version","title":"jQuery.browser","type":"property","signatures":[{"added":"1.1.3"}],"desc":"The version number of the rendering engine for the user's browser.","longdesc":"\n    <p>Here are some typical results:<\/p>\n    <ul>\n      <li>Internet Explorer: 6.0, 7.0, 8.0<\/li>\n      <li>Mozilla\/Firefox\/Flock\/Camino: 1.7.12, 1.8.1.3, 1.9<\/li>\n      <li>Opera: 10.06, 11.01<\/li>\n      <li>Safari\/Webkit: 312.8, 418.9<\/li>\n    <\/ul>\n    <p>Note that IE8 claims to be 7 in Compatibility View.<\/p>\n  ","categories":["Deprecated","Properties > Properties of the Global jQuery Object","Utilities","Version > Version 1.0","Version > Version 1.1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.Callbacks\/","name":"jQuery.Callbacks","title":"jQuery.Callbacks()","type":"","signatures":[{"added":"1.7","params":[{"name":"flags","type":"String","optional":"","desc":"An optional list of space-separated flags that change how the callback list behaves."}]}],"desc":"A multi-purpose callbacks list object that provides a powerful way to manage callback lists.","longdesc":"\n\n<p>The <code>$.Callbacks()<\/code> function is internally used to provide the base functionality behind the jQuery <code>$.ajax()<\/code> and <code>$.Deferred()<\/code> components. It can be used as a similar base to define functionality for new components.<\/p>\n<p><code>$.Callbacks()<\/code> support a number of methods including <code><a href=\"\/callbacks.add\/\">callbacks.add()<\/a><\/code>,<code><a href=\"\/callbacks.remove\/\">callbacks.remove()<\/a><\/code>, <code><a href=\"\/callbacks.fire\/\">callbacks.fire()<\/a><\/code> and <code><a href=\"\/callbacks.disable\/\">callbacks.disable()<\/a><\/code>.<\/p>\n<h3 id=\"getting-started\">Getting started<\/h3>\n\n<p>The following are two sample methods named <code>fn1<\/code> and <code>fn2<\/code>:<\/p>\n<pre>\nfunction fn1( value ){\n    console.log( value );\n}\n\nfunction fn2( value ){\n    fn1(\"fn2 says:\" + value);\n    return false;\n}\n<\/pre>\n<p>These can be added as callbacks to a <code>$.Callbacks<\/code> list and invoked follows:<\/p>\n<pre>\nvar callbacks = $.Callbacks();\ncallbacks.add( fn1 );\ncallbacks.fire( \"foo!\" ); \/\/ outputs: foo!\n\ncallbacks.add( fn2 );\ncallbacks.fire( \"bar!\" ); \/\/ outputs: bar!, fn2 says: bar!\n<\/pre>\n\n<p>The result of this is that it becomes simple to construct complex lists of callbacks where input values can be passed through to as many functions as needed with ease.<\/p>\n<p>Two specific methods were being used above: <code>.add()<\/code> and <code>.fire()<\/code> .add() supports adding new callbacks to the callback list, whilst fire() provides a way to pass arguments to be processed by the callbacks in the same list.<\/p>\n<p>Another method supported by <code>$.Callbacks<\/code> is remove(), which has the ability to remove a particular callback from the callback list. Here\"s a practical example of .remove() being used:<\/p>\n<pre>\nvar callbacks = $.Callbacks();\ncallbacks.add( fn1 );\ncallbacks.fire( \"foo!\" ); \/\/ outputs: foo!\n\ncallbacks.add( fn2 );\ncallbacks.fire( \"bar!\" ); \/\/ outputs: bar!, fn2 says: bar!\n\ncallbacks.remove(fn2);\ncallbacks.fire( \"foobar\" ); \n\n\/\/ only outputs foobar, as fn2 has been removed.\n<\/pre>\n\n<h3 id=\"supported-flags\">Supported Flags<\/h3>\n\n<p>The <code>flags<\/code> argument is an optional argument to <code>$.Callbacks()<\/code>, structured as a list of space-separated strings that change how the callback list behaves (eg. <code>$.Callbacks( 'unique stopOnFalse' )<\/code>).<\/p>\n\n<h2>Possible flags:<\/h2>\n<ul>\n    <li><code>once<\/code>: Ensures the callback list can only be fired once (like a Deferred).<\/li>\n    <li><code>memory<\/code>: Keep track of previous values and will call any callback added after the list has been fired right away with the latest \"memorized\" values (like a Deferred).<\/li>\n    <li><code>unique<\/code>: Ensures a callback can only be added once (so there are no duplicates in the list).<\/li>\n    <li><code>stopOnFalse<\/code>: Interrupts callings when a callback returns false.<\/li>\n<\/ul>\n<p>By default a callback list will act like an event callback list and can be \"fired\" multiple times.<\/p>\n\n<p>For examples of how <code>flags<\/code> should ideally be used, see below:<\/p>\n\n<h2 id=\"once\"><code>$.Callbacks( 'once' )<\/code>:<\/h2>\n<pre>\nvar callbacks = $.Callbacks( \"once\" );\ncallbacks.add( fn1 );\ncallbacks.fire( \"foo\" );\ncallbacks.add( fn2 );\ncallbacks.fire( \"bar\" );\ncallbacks.remove( fn2 );\ncallbacks.fire( \"foobar\" );\n\n\/*\noutput: \nfoo\n*\/\n<\/pre>\n\n\n<h2 id=\"memory\"><code>$.Callbacks( 'memory' )<\/code>:<\/h2>\n<pre>var callbacks = $.Callbacks( \"memory\" );\ncallbacks.add( fn1 );\ncallbacks.fire( \"foo\" );\ncallbacks.add( fn2 );\ncallbacks.fire( \"bar\" );\ncallbacks.remove( fn2 );\ncallbacks.fire( \"foobar\" );\n\n\/*\noutput:\nfoo\nfn2 says:foo\nbar\nfn2 says:bar\nfoobar\n*\/\n<\/pre>\n\n\n<h2 id=\"unique\"><code>$.Callbacks( 'unique' )<\/code>:<\/h2>\n<pre>var callbacks = $.Callbacks( \"unique\" );\ncallbacks.add( fn1 );\ncallbacks.fire( \"foo\" );\ncallbacks.add( fn1 ); \/\/ repeat addition\ncallbacks.add( fn2 );\ncallbacks.fire( \"bar\" );\ncallbacks.remove( fn2 );\ncallbacks.fire( \"foobar\" );\n\n\/*\noutput:\nfoo\nbar\nfn2 says:bar\nfoobar\n*\/\n<\/pre>\n\n\n<h2 id=\"stopOnFalse\"><code>$.Callbacks( 'stopOnFalse' )<\/code>:<\/h2>\n<pre>\nfunction fn1( value ){\n    console.log( value );\n    return false;\n}\n\nfunction fn2( value ){\n    fn1(\"fn2 says:\" + value);\n    return false;\n}\n\nvar callbacks = $.Callbacks( \"stopOnFalse\");\ncallbacks.add( fn1 );\ncallbacks.fire( \"foo\" );\ncallbacks.add( fn2 );\ncallbacks.fire( \"bar\" );\ncallbacks.remove( fn2 );\ncallbacks.fire( \"foobar\" );\n\n\/*\noutput:\nfoo\nbar\nfoobar\n*\/\n<\/pre>\n\n\n<p>Because $.Callbacks() supports a list of flags rather than just one, setting several flags has a cumulative effect similar to \"&amp;&amp;\". This means it's possible to combine flags to create callback lists that are say, both <i>unique<\/i> and <i>ensure if list was already fired, adding more callbacks will have it called with the latest fired value<\/i> (i.e. <code>$.Callbacks(\"unique memory\")<\/code>).<\/p>\n\n<h2 id=\"unique-memory\"><code>$.Callbacks( 'unique memory' )<\/code>:<\/h2>\n\n<pre>\nfunction fn1( value ){\n    console.log( value );\n    return false;\n}\n\nfunction fn2( value ){\n    fn1(\"fn2 says:\" + value);\n    return false;\n}\n    \nvar callbacks = $.Callbacks( \"unique memory\" );\ncallbacks.add( fn1 );\ncallbacks.fire( \"foo\" );\ncallbacks.add( fn1 ); \/\/ repeat addition\ncallbacks.add( fn2 );\ncallbacks.fire( \"bar\" );\ncallbacks.add( fn2 );\ncallbacks.fire( \"baz\" );\ncallbacks.remove( fn2 );\ncallbacks.fire( \"foobar\" );\n\n\/*\noutput:\nfoo\nfn2 says:foo\nbar\nfn2 says:bar\nbaz\nfn2 says:baz\nfoobar\n*\/\n<\/pre>\n\n<p>Flag combinations are internally used with <code>$.Callbacks()<\/code> in jQuery for the <code>.done()<\/code> and <code>.fail()<\/code> buckets on a Deferred - both of which use <code>$.Callbacks('memory once')<\/code>.<\/p>\n<p>$.Callbacks methods can also be detached, should there be a need to define short-hand versions for convenience:<\/p>\n\n<pre>\nvar callbacks = $.Callbacks(),\n    add = callbacks.add,\n    remove = callbacks.remove,\n    fire = callbacks.fire;\n\nadd( fn1 );\nfire( \"hello world\");\nremove( fn1 );\n<\/pre>\n\n\n<h3 id=\"pubsub\">$.Callbacks, $.Deferred and Pub\/Sub<\/h3>\n\n\n<p>The general idea behind pub\/sub (the Observer pattern) is the promotion of loose coupling in applications. Rather than single objects calling on the methods of other objects, an object instead subscribes to a specific task or activity of another object and is notified when it occurs. Observers are also called Subscribers and we refer to the object being observed as the Publisher (or the subject). Publishers notify subscribers when events occur<\/p>\n<p>As a demonstration of the component-creation capabilities of <code>$.Callbacks()<\/code>, it's possible to implement a Pub\/Sub system using only callback lists. Using <code>$.Callbacks<\/code> as a topics queue, a system for publishing and subscribing to topics can be implemented as follows:<\/p>\n\n<pre>var topics = {};\n\njQuery.Topic = function( id ) {\n    var callbacks,\n        method,\n        topic = id &amp;&amp; topics[ id ];\n    if ( !topic ) {\n        callbacks = jQuery.Callbacks();\n        topic = {\n            publish: callbacks.fire,\n            subscribe: callbacks.add,\n            unsubscribe: callbacks.remove\n        };\n        if ( id ) {\n            topics[ id ] = topic;\n        }\n    }\n    return topic;\n};\n<\/pre>\n\n\n<p>This can then be used by parts of your application to publish and subscribe to events of interest quite easily:<\/p>\n\n<pre>\/\/ Subscribers\n$.Topic( \"mailArrived\" ).subscribe( fn1 );\n$.Topic( \"mailArrived\" ).subscribe( fn2 );\n$.Topic( \"mailSent\" ).subscribe( fn1 );\n\n\/\/ Publisher\n$.Topic( \"mailArrived\" ).publish( \"hello world!\" );\n$.Topic( \"mailSent\" ).publish( \"woo! mail!\" );\n\n\/\/ Here, \"hello world!\" gets pushed to fn1 and fn2\n\/\/ when the \"mailArrived\" notification is published\n\/\/ with \"woo! mail!\" also being pushed to fn1 when\n\/\/ the \"mailSent\" notification is published. \n\n\/*\noutput:\nhello world!\nfn2 says: hello world!\nwoo! mail!\n*\/\n<\/pre>\n\n\n<p>Whilst this is useful, the implementation can be taken further. Using <code>$.Deferreds<\/code>,  it's possible to ensure publishers only publish notifications for subscribers once particular tasks have been completed (resolved). See the below code sample for some further comments on how this could be used in practice:<\/p>\n\n<pre>\/\/ subscribe to the mailArrived notification\n$.Topic( \"mailArrived\" ).subscribe( fn1 );\n\n\/\/ create a new instance of Deferreds\nvar dfd = $.Deferred();\n\n\/\/ define a new topic (without directly publishing)\nvar topic = $.Topic( \"mailArrived\" );\n\n\/\/ when the deferred has been resolved, publish a \n\/\/ notification to subscribers\ndfd.done( topic.publish );\n\n\/\/ Here the Deferred is being resolved with a message\n\/\/ that will be passed back to subscribers. It's possible to\n\/\/ easily integrate this into a more complex routine\n\/\/ (eg. waiting on an ajax call to complete) so that\n\/\/ messages are only published once the task has actually\n\/\/ finished.\ndfd.resolve( \"its been published!\" );\n<\/pre>\n\n","categories":["Callbacks Object","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.contains\/","name":"jQuery.contains","title":"jQuery.contains()","type":"method","signatures":[{"added":"1.4","params":[{"name":"container","type":"Element","optional":"","desc":"The DOM element that may contain the other element."},{"name":"contained","type":"Element","optional":"","desc":"The DOM element that may be contained by the other element."}]}],"desc":"Check to see if a DOM element is within another DOM element.","longdesc":"\n<blockquote><p><strong>Note:<\/strong> The first argument <em>must<\/em> be a DOM element, not a jQuery object or plain JavaScript object.<\/p><\/blockquote>","categories":["Utilities","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.cssHooks\/","name":"jQuery.cssHooks","title":"jQuery.cssHooks","type":"property","signatures":[{"added":"1.4.3"}],"desc":"Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.","longdesc":"<p>The <code>$.cssHooks<\/code> object provides a way to define functions for getting and setting particular CSS values. It can also be used to create new cssHooks for normalizing CSS3 features such as box shadows and gradients. <\/p>\n<p>For example, some versions of Webkit-based browsers require <code>-webkit-border-radius<\/code> to set the <code>border-radius<\/code> on an element, while earlier Firefox versions require <code>-moz-border-radius<\/code>. A css hook can normalize these vendor-prefixed properties to let <code>.css()<\/code> accept a single, standard property name (<code>border-radius<\/code>, or with DOM property syntax, <code>borderRadius<\/code>).<\/p>\n<p>In addition to providing fine-grained control over how specific style properties are handled, <code>$.cssHooks<\/code> also extends the set of properties available to the <code>.animate()<\/code> method.<\/p>\n  <p>Defining a new css hook is straight-forward. The skeleton template below can serve as a guide to creating your own. <\/p>\n<pre class=\"prettyprint\">(function($) {\n  \/\/ first, check to see if cssHooks are supported\n  if ( !$.cssHooks ) {\n    \/\/ if not, output an error message\n    throw(\"jQuery 1.4.3 or above is required for this plugin to work\");\n    return;\n  }\n\n  $.cssHooks[\"someCSSProp\"] = {\n    get: function( elem, computed, extra ) {\n      \/\/ handle getting the CSS property\n    },\n    set: function( elem, value ) {\n      \/\/ handle setting the CSS value\n    }\n  };\n})(jQuery);\n<\/pre>\n<h4 id=\"feature-testing\">Feature Testing<\/h4>\n  <p>Before normalizing a vendor-specific CSS property, first determine whether the browser supports the standard property or a vendor-prefixed variation. For example, to check for support of the <code>border-radius<\/code> property, see if any variation is a member of a temporary element's <code>style<\/code> object.<\/p>\n<pre class=\"prettyprint\">(function($) {\n  function styleSupport( prop ) {\n    var vendorProp, supportedProp,\n\n        \/\/ capitalize first character of the prop to test vendor prefix\n        capProp = prop.charAt(0).toUpperCase() + prop.slice(1),\n        prefixes = [ \"Moz\", \"Webkit\", \"O\", \"ms\" ],\n        div = document.createElement( \"div\" );\n\n    if ( prop in div.style ) {\n\n      \/\/ browser supports standard CSS property name\n      supportedProp = prop;\n    } else {\n\n      \/\/ otherwise test support for vendor-prefixed property names\n      for ( var i = 0; i &lt; prefixes.length; i++ ) {\n        vendorProp = prefixes[i] + capProp;\n        if ( vendorProp in div.style ) {\n          supportedProp = vendorProp;\n          break;\n        }\n      }\n    }\n\n    \/\/ avoid memory leak in IE\n    div = null;\n    \n    \/\/ add property to $.support so it can be accessed elsewhere\n    $.support[ prop ] = supportedProp;\n    \n    return supportedProp;\n  }\n\n  \/\/ call the function, e.g. testing for \"border-radius\" support:\n  styleSupport( \"borderRadius\" );\n})(jQuery);\n<\/pre>\n<h4 id=\"defining-complete-csshook\">Defining a complete css hook<\/h4>\n<p>To define a complete css hook, combine the support test with a filled-out version of the skeleton template provided in the first example:<\/p>\n<pre class=\"prettyprint\">(function($) {\n  if ( !$.cssHooks ) {\n    throw(\"jQuery 1.4.3+ is needed for this plugin to work\");\n    return;\n  }\n  \n  function styleSupport( prop ) {\n    var vendorProp, supportedProp,\n        capProp = prop.charAt(0).toUpperCase() + prop.slice(1),\n        prefixes = [ \"Moz\", \"Webkit\", \"O\", \"ms\" ],\n        div = document.createElement( \"div\" );\n\n    if ( prop in div.style ) {\n      supportedProp = prop;\n    } else {\n      for ( var i = 0; i &lt; prefixes.length; i++ ) {\n        vendorProp = prefixes[i] + capProp;\n        if ( vendorProp in div.style ) {\n          supportedProp = vendorProp;\n          break;\n        }\n      }\n    }\n\n    div = null;\n    $.support[ prop ] = supportedProp\n    return supportedProp;\n  }\n\n  var borderRadius = styleSupport( \"borderRadius\" );\n\n  \/\/ Set cssHooks only for browsers that\n  \/\/ support a vendor-prefixed border radius\n  if ( borderRadius &amp;&amp; borderRadius !== \"borderRadius\" ) {\n    $.cssHooks.borderRadius = {\n      get: function( elem, computed, extra ) {\n        return $.css( elem, borderRadius );\n      },\n      set: function( elem, value) {\n        elem.style[ borderRadius ] = value;\n      }\n    };\n  }\n})(jQuery);\n<\/pre>\n\n  <p>You can then set the border radius in a supported browser using either the DOM (camelCased) style or the CSS (hyphenated) style:<\/p>\n<pre class=\"prettyprint\">\n$(\"#element\").css(\"borderRadius\", \"10px\");\n$(\"#another\").css(\"border-radius\", \"20px\");\n<\/pre>\n  <p>If the browser lacks support for any form of the CSS property, vendor-prefixed or not, the style is not applied to the element. However, if the browser supports a proprietary alternative, it can be applied to the cssHooks instead. <\/p>\n<pre class=\"prettyprint\">\n (function($) {\n  \/\/ feature test for support of a CSS property\n  \/\/ and a proprietary alternative\n  \/\/ ...\n\n\n if ( $.support.someCSSProp &amp;&amp; $.support.someCSSProp !== \"someCSSProp\" ) {\n\n    \/\/ Set cssHooks for browsers that\n    \/\/ support only a vendor-prefixed someCSSProp\n    $.cssHooks.someCSSProp = {\n      get: function( elem, computed, extra ) {\n        return $.css( elem, $.support.someCSSProp );\n      },\n      set: function( elem, value) {\n        elem.style[ $.support.someCSSProp ] = value;\n      }\n    };\n  } else if ( supportsProprietaryAlternative ) {\n    $.cssHooks.someCSSProp = {\n      get: function( elem, computed, extra ) {\n        \/\/ Handle crazy conversion from the proprietary alternative \n      },\n      set: function( elem, value ) {\n        \/\/ Handle crazy conversion to the proprietary alternative\n      }\n    }\n  }\n\n})(jQuery);\n<\/pre>\n  <h4 id=\"special-units\">Special units<\/h4>\n  <p>By default, jQuery adds a \"px\" unit to the values passed to the <code>.css()<\/code> method. This behavior can be prevented by adding the property to the <code>jQuery.cssNumber<\/code> object<\/p>\n\n<pre class=\"prettyprint\">$.cssNumber[\"someCSSProp\"] = true;<\/pre>\n\n  <h4 id=\"animating\">Animating with cssHooks<\/h4>\n  <p>A css hook can also hook into jQuery's animation mechanism by adding a property to the <code>jQuery.fx.step<\/code> object:<\/p>\n<pre class=\"prettyprint\">$.fx.step[\"someCSSProp\"] = function(fx){\n  $.cssHooks[\"someCSSProp\"].set( fx.elem, fx.now + fx.unit );\n};\n<\/pre>\n<p>Note that this works best for simple numeric-value animations. More custom code may be required depending on the CSS property, the type of value it returns, and the animation's complexity.<\/p>\n","categories":["CSS","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.data\/","name":"jQuery.data","title":"jQuery.data()","type":"method","signatures":[{"added":"1.2.3","params":[{"name":"element","type":"Element","optional":"","desc":"The DOM element to associate with the data."},{"name":"key","type":"String","optional":"","desc":"A string naming the piece of data to set."},{"name":"value","type":"Object","optional":"","desc":"The new data value."}]}],"desc":"Store arbitrary data associated with the specified element. Returns the value that was set.","longdesc":"<p><strong>Note:<\/strong> This is a low-level method; a more convenient <code><a href=\"\/data\">.data()<\/a><\/code> is also available.<\/p>\n\t<p>The <code>jQuery.data()<\/code> method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore free from memory leaks. jQuery ensures that the data is removed when DOM elements are removed via jQuery methods, and when the user leaves the page. We can set several distinct values for a single element and retrieve them later:<\/p>\n<pre>\njQuery.data(document.body, 'foo', 52);\njQuery.data(document.body, 'bar', 'test');\n<\/pre>\n<p><em>Note:<\/em> this method currently does not provide cross-platform support for setting data on XML documents, as Internet Explorer does not allow data to be attached via expando properties.<\/p>\n","categories":["Data","Utilities","Version > Version 1.2.3","Version > Version 1.4","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.data\/","name":"jQuery.data","title":"jQuery.data()","type":"method","signatures":[{"added":"1.2.3","params":[{"name":"element","type":"Element","optional":"","desc":"The DOM element to query for the data."},{"name":"key","type":"String","optional":"","desc":"Name of the data stored."}]},{"added":"1.4","params":[{"name":"element","type":"Element","optional":"","desc":"The DOM element to query for the data."}]}],"desc":"Returns value at named data store for the element, as set by <code>jQuery.data(element, name, value)<\/code>, or the full data store for the element.","longdesc":"<p><strong>Note:<\/strong> This is a low-level method; a more convenient <code><a href=\"\/data\">.data()<\/a><\/code> is also available.<\/p>\n<p><strong>Regarding HTML5 data-* attributes:<\/strong> This low-level method does NOT retrieve the <code>data-*<\/code> attributes unless the more convenient <code><a href=\"\/data\">.data()<\/a><\/code> method has already retrieved them.<\/p>\n<p>The <code>jQuery.data()<\/code> method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore from memory leaks. We can retrieve several distinct values for a single element one at a time, or as a set:<\/p>\n<pre>alert(jQuery.data( document.body, 'foo' ));\nalert(jQuery.data( document.body ));<\/pre>\n<p>The above lines alert the data values that were set on the <code>body<\/code> element. If nothing was set on that element, an empty string is returned.<\/p>\n<p>Calling <code>jQuery.data(element)<\/code> retrieves all of the element's associated values as a JavaScript object. Note that jQuery itself uses this method to store data for internal use, such as event handlers, so do not assume that it contains only data that your own code has stored.<\/p>\n<p><em>Note:<\/em> this method currently does not provide cross-platform support for setting data on XML documents, as Internet Explorer does not allow data to be attached via expando properties.<\/p>\n\n","categories":["Data","Utilities","Version > Version 1.2.3","Version > Version 1.4","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.dequeue\/","name":"jQuery.dequeue","title":"jQuery.dequeue()","type":"method","signatures":[{"added":"1.3","params":[{"name":"element","type":"Element","optional":"","desc":"A DOM element from which to remove and execute a queued function."},{"name":"queueName","type":"String","optional":"optional","desc":"A string containing the name of the queue. Defaults to <code>fx<\/code>, the standard effects queue."}]}],"desc":"Execute the next function on the queue for the matched element.","longdesc":"<p><strong>Note:<\/strong> This is a low-level method, you should probably use <code><a href=\"\/dequeue\">.dequeue()<\/a><\/code> instead.<\/p>\n<p>When <code>jQuery.dequeue()<\/code> is called, the next function on the queue is removed from the queue, and then executed. This function should in turn (directly or indirectly) cause <code>jQuery.dequeue()<\/code> to be called, so that the sequence can continue.<\/p>","categories":["Data","Utilities","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.each\/","name":"jQuery.each","title":"jQuery.each()","type":"method","signatures":[{"added":"1.0","params":[{"name":"collection","type":"Object","optional":"","desc":"The object or array to iterate over."},{"name":"callback(indexInArray, valueOfElement)","type":"Function","optional":"","desc":"The function that will be executed on every object."}]}],"desc":"A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.","longdesc":"\n    <p>The <code>$.each()<\/code> function is not the same as <a href=\"\/each\/\">$(selector).each()<\/a>, which is used to iterate, exclusively, over a jQuery object. The <code>$.each()<\/code> function can be used to iterate over any collection, whether it is a map (JavaScript object) or an array. In the case of an array, the callback is passed an array index and a corresponding array value each time. (The value can also be accessed through the <code>this<\/code> keyword, but Javascript will always wrap the <code>this<\/code> value as an <code>Object<\/code> even if it is a simple string or number value.) The method returns its first argument, the object that was iterated.<\/p>\n\n<pre>$.each([52, 97], function(index, value) { \n  alert(index + ': ' + value); \n});\n<\/pre>\n<p>This produces two messages:<\/p>\n<p>\n  <span class=\"output\">0: 52<\/span><br\/>\n  <span class=\"output\">1: 97<\/span>\n<\/p>\n    <p>If a map is used as the collection, the callback is passed a key-value pair each time:<\/p>\n<pre>var map = { \n  'flammable': 'inflammable', \n  'duh': 'no duh' \n}; \n$.each(map, function(key, value) { \n  alert(key + ': ' + value); \n});<\/pre>\n    <p>Once again, this produces two messages:<\/p>\n    <p>\n      <span class=\"output\">flammable: inflammable<\/span><br\/>\n      <span class=\"output\">duh: no duh<\/span>\n    <\/p>\n    \n    <p>We can break the <code>$.each()<\/code> loop at a particular iteration by making the callback function return <code>false<\/code>. Returning <em>non-false<\/em> is the same as a <code>continue<\/code> statement in a for loop; it will skip immediately to the next iteration.<\/p>","categories":["Utilities","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.error\/","name":"jQuery.error","title":"jQuery.error","type":"method","signatures":[{"added":"1.4.1","params":[{"name":"message","type":"String","optional":"","desc":"The message to send out."}]}],"desc":"Takes a string and throws an exception containing it.","longdesc":"<p>This method exists primarily for plugin developers who wish to override it and provide a better display (or more information) for the error messages.<\/p>","categories":["Internals","Version > Version 1.4.1"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.extend\/","name":"jQuery.extend","title":"jQuery.extend()","type":"method","signatures":[{"added":"1.0","params":[{"name":"target","type":"Object","optional":"","desc":" An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument."},{"name":"object1","type":"Object","optional":"optional","desc":"An object containing additional properties to merge in."},{"name":"objectN","type":"Object","optional":"optional","desc":"Additional objects containing properties to merge in."}]},{"added":"1.1.4","params":[{"name":"deep","type":"Boolean","optional":"optional","desc":"If true, the merge becomes recursive (aka. deep copy)."},{"name":"target","type":"Object","optional":"","desc":"The object to extend. It will receive the new properties."},{"name":"object1","type":"Object","optional":"","desc":"An object containing additional properties to merge in."},{"name":"objectN","type":"Object","optional":"optional","desc":"Additional objects containing properties to merge in."}]}],"desc":"Merge the contents of two or more objects together into the first object.","longdesc":"<p>When we supply two or more objects to <code>$.extend()<\/code>, properties from all of the objects are added to the target object.<\/p>\n  <p>If only one argument is supplied to <code>$.extend()<\/code>, this means the target argument was omitted. In this case, the jQuery object itself is assumed to be the target. By doing this, we can add new functions to the jQuery namespace.  This can be useful for plugin authors wishing to add new methods to JQuery.<\/p>\n  <p>Keep in mind that the target object (first argument) will be modified, and will also be returned from <code>$.extend()<\/code>. If, however, we want to preserve both of the original objects, we can do so by passing an empty object as the target:<\/p>\n  <pre>var object = $.extend({}, object1, object2);<\/pre>\n\n  <p>The merge performed by <code>$.extend()<\/code> is not recursive by default; if a property of the first object is itself an object or array, it will be completely overwritten by a property with the same key in the second object. The values are not merged. This can be seen in the example below by examining the value of banana. However, by passing <code>true<\/code> for the first function argument, objects will be recursively merged. (Passing <code>false<\/code> for the first argument is not supported.)<\/p>\n  <p>Undefined properties are not copied. However, properties inherited from the object's prototype <em>will<\/em> be copied over. Properties that are an object constructed via <code>new MyCustomObject(args)<\/code>, or built-in JavaScript types such as Date or RegExp, are not re-constructed and will appear as plain Objects in the resulting object or array.<\/p>\n  <p>On a <code>deep<\/code> extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not.<\/p>\n  <p>For needs that fall outside of this behavior, write a custom extend method instead. <\/p>\n\n\n  ","categories":["Utilities","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.fx.interval\/","name":"jQuery.fx.interval","title":"jQuery.fx.interval","type":"property","signatures":[{"added":"1.4.3"}],"desc":"The rate (in milliseconds) at which animations fire.","longdesc":"\n    <p>This property can be manipulated to adjust the number of frames per second at which animations will run. The default is 13 milliseconds. Making this a lower number could make the animations run smoother in faster browsers (such as Chrome) but there may be performance and CPU implications of doing so.<\/p>\n    <p>Since jQuery uses one global interval, no animation should be running or all animations should stop for the change of this property to take effect.<\/p>\n<p><strong>Note:<\/strong><code>jQuery.fx.interval<\/code> currently has no effect in browsers that support the <code>requestAnimationFrame<\/code> property, such as Google Chrome 11. This behavior is subject to change in a future release.<\/p>\n  ","categories":["Effects > Custom","Properties > Properties of the Global jQuery Object","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.fx.off\/","name":"jQuery.fx.off","title":"jQuery.fx.off","type":"property","signatures":[{"added":"1.3"}],"desc":"Globally disable all animations.","longdesc":"\n    <p>When this property is set to <code>true<\/code>, all animation methods will immediately set elements to their final state when called, rather than displaying an effect. This may be desirable for a couple reasons:<\/p>\n    <ul>\n    <li>jQuery is being used on a low-resource device.<\/li>\n    <li>Users are encountering accessibility problems with the animations (see the article <a href=\"http:\/\/www.jdeegan.phlegethon.org\/turn_off_animation.html\">Turn Off Animation<\/a> for more information).<\/li>\n    <\/ul>\n<p>Animations can be turned back on by setting the property to <code>false<\/code>.<\/p>\n\n  ","categories":["Effects > Custom","Properties > Properties of the Global jQuery Object","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.get\/","name":"jQuery.get","title":"jQuery.get()","type":"method","signatures":[{"added":"1.0","params":[{"name":"url","type":"String","optional":"","desc":"A string containing the URL to which the request is sent."},{"name":"data","type":"Map, String","optional":"optional","desc":"A map or string that is sent to the server with the request."},{"name":"success(data, textStatus, jqXHR)","type":"Function","optional":"optional","desc":"A callback function that is executed if the request succeeds."},{"name":"dataType","type":"String","optional":"optional","desc":"The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html)."}]}],"desc":"Load data from the server using a HTTP GET request.","longdesc":"<p>This is a shorthand Ajax function, which is equivalent to:<\/p>\n    <pre>$.ajax({\n  url: <em>url<\/em>,\n  data: <em>data<\/em>,\n  success: <em>success<\/em>,\n  dataType: <em>dataType<\/em>\n});\n<\/pre>\n    <p>The <code>success<\/code> callback function is passed the returned data, which will be an XML root element, text string, JavaScript file, or JSON object, depending on the MIME type of the response. It is also passed the text status of the response. <\/p>\n    <p><strong>As of jQuery 1.5<\/strong>, the <code>success<\/code> callback function is also passed a <a href=\"http:\/\/api.jquery.com\/jQuery.get\/#jqxhr-object\">\"jqXHR\" object<\/a> (in <strong>jQuery 1.4<\/strong>, it was passed the <code>XMLHttpRequest<\/code> object). However, since JSONP and cross-domain GET requests do not use <abbr title=\"XMLHTTPRequest\">XHR<\/abbr>,  in those cases the <code>(j)XHR<\/code> and <code>textStatus<\/code> parameters passed to the success callback are undefined.<\/p>\n    <p>Most implementations will specify a success handler:<\/p>\n    <pre>$.get('ajax\/test.html', function(data) {\n  $('.result').html(data);\n  alert('Load was performed.');\n});\n<\/pre>\n  <p>This example fetches the requested HTML snippet and inserts it on the page.<\/p>\n  <h4 id=\"jqxhr-object\">The jqXHR Object<\/h4>\n  <p><strong>As of jQuery 1.5<\/strong>, all of jQuery's Ajax methods return  a superset of the <code>XMLHTTPRequest<\/code> object. This jQuery XHR object, or \"jqXHR,\" returned by <code>$.get()<\/code> implements the Promise interface, giving it all the properties, methods, and behavior of a Promise (see <a href=\"http:\/\/api.jquery.com\/category\/deferred-object\/\">Deferred object<\/a> for more information). For convenience and consistency with the callback names used by <code><a href=\"http:\/\/api.jquery.com\/jQuery.ajax\/\">$.ajax()<\/a><\/code>, it provides <code>.error()<\/code>, <code>.success()<\/code>, and <code>.complete()<\/code> methods. These methods take a function argument that is called when the request terminates, and the function receives the same arguments as the correspondingly-named <code>$.ajax()<\/code> callback.<\/p>\n\n  <p>The Promise interface in jQuery 1.5 also allows jQuery's Ajax methods, including <code>$.get()<\/code>, to chain multiple <code>.success()<\/code>, <code>.complete()<\/code>, and <code>.error()<\/code> callbacks on a single request, and even to assign these callbacks after the request may have completed. If the request is already complete, the callback is fired immediately.<\/p>\n  <pre>\/\/ Assign handlers immediately after making the request,\n  \/\/ and remember the jqxhr object for this request\n  var jqxhr = $.get(\"example.php\", function() {\n    alert(\"success\");\n  })\n  .success(function() { alert(\"second success\"); })\n  .error(function() { alert(\"error\"); })\n  .complete(function() { alert(\"complete\"); });\n\n  \/\/ perform other work here ...\n\n  \/\/ Set another completion function for the request above\n  jqxhr.complete(function(){ alert(\"second complete\"); });<\/pre>\n","categories":["Ajax > Shorthand Methods","Version > Version 1.0","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.getJSON\/","name":"jQuery.getJSON","title":"jQuery.getJSON()","type":"method","signatures":[{"added":"1.0","params":[{"name":"url","type":"String","optional":"","desc":"A string containing the URL to which the request is sent."},{"name":"data","type":"Map","optional":"optional","desc":"A map or string that is sent to the server with the request."},{"name":"success(data, textStatus, jqXHR)","type":"Function","optional":"optional","desc":"A callback function that is executed if the request succeeds."}]}],"desc":"Load JSON-encoded data from the server using a GET HTTP request.","longdesc":"\n    <p>This is a shorthand Ajax function, which is equivalent to:<\/p>\n        <pre>$.ajax({\n  url: <em>url<\/em>,\n  dataType: 'json',\n  data: <em>data<\/em>,\n  success: <em>callback<\/em>\n});\n<\/pre>\n    <p>Data that is sent to the server is appended to the URL as a query string. If the value of the <code>data<\/code> parameter is an object (map), it is converted to a string and url-encoded before it is appended to the URL.<\/p>\n\n  <p>Most implementations will specify a success handler:<\/p>\n  <pre>$.getJSON('ajax\/test.json', function(data) {\n  var items = [];\n\n  $.each(data, function(key, val) {\n    items.push('&lt;li id=\"' + key + '\"&gt;' + val + '&lt;\/li&gt;');\n  });\n\n  $('&lt;ul\/&gt;', {\n    'class': 'my-new-list',\n    html: items.join('')\n  }).appendTo('body');\n});\n<\/pre>\n<p>This example, of course, relies on the structure of the JSON file:<\/p>\n  <pre>{\n  \"one\": \"Singular sensation\",\n  \"two\": \"Beady little eyes\",\n  \"three\": \"Little birds pitch by my doorstep\"\n}\n<\/pre>\n<p>Using this structure, the example loops through the requested data, builds an unordered list, and appends it to the body.<\/p>\n<p>The <code>success<\/code> callback is passed the returned data, which is typically a JavaScript object or array as defined by the JSON structure and parsed using the <code><a href=\"\/jQuery.parseJSON\">$.parseJSON()<\/a><\/code> method. It is also passed the text status of the response.<\/p>\n<p><strong>As of jQuery 1.5<\/strong>, the <code>success<\/code> callback function receives a <a href=\"http:\/\/api.jquery.com\/jQuery.get\/#jqxhr-object\">\"jqXHR\" object<\/a> (in <strong>jQuery 1.4<\/strong>, it received the <code>XMLHttpRequest<\/code> object). However, since JSONP and cross-domain GET requests do not use <abbr title=\"XMLHTTPRequest\">XHR<\/abbr>, in those cases the <code>jqXHR<\/code> and <code>textStatus<\/code> parameters passed to the success callback are undefined.<\/p>\n  <blockquote>\n    <p><strong>Important:<\/strong> As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason. JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript's object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes. For details on the JSON format, see <a href=\"http:\/\/json.org\/\">http:\/\/json.org\/<\/a>.<\/p>\n  <\/blockquote>\n  <h4 id=\"jsonp\">JSONP<\/h4>\n  <p>If the URL includes the string \"callback=?\" (or similar, as defined by the server-side API), the request is treated as JSONP instead. See the discussion of the <code>jsonp<\/code> data type in <code><a href=\"http:\/\/api.jquery.com\/jQuery.ajax\/\">$.ajax()<\/a><\/code> for more details.<\/p>\n\n\n<h4 id=\"jqxhr-object\">The jqXHR Object<\/h4>\n<p><strong>As of jQuery 1.5<\/strong>, all of jQuery's Ajax methods return  a superset of the <code>XMLHTTPRequest<\/code> object. This jQuery XHR object, or \"jqXHR,\" returned by <code>$.getJSON()<\/code> implements the Promise interface, giving it all the properties, methods, and behavior of a Promise (see <a href=\"http:\/\/api.jquery.com\/category\/deferred-object\/\">Deferred object<\/a> for more information). For convenience and consistency with the callback names used by <code><a href=\"http:\/\/api.jquery.com\/jQuery.ajax\/\">$.ajax()<\/a><\/code>, it provides <code>.error()<\/code>, <code>.success()<\/code>, and <code>.complete()<\/code> methods. These methods take a function argument that is called when the request terminates, and the function receives the same arguments as the correspondingly-named <code>$.ajax()<\/code> callback.<\/p>\n\n<p>The Promise interface in jQuery 1.5 also allows jQuery's Ajax methods, including <code>$.getJSON()<\/code>, to chain multiple <code>.success()<\/code>, <code>.complete()<\/code>, and <code>.error()<\/code> callbacks on a single request, and even to assign these callbacks after the request may have completed. If the request is already complete, the callback is fired immediately.<\/p>\n<pre>\/\/ Assign handlers immediately after making the request,\n\/\/ and remember the jqxhr object for this request\nvar jqxhr = $.getJSON(\"example.json\", function() {\n  alert(\"success\");\n})\n.success(function() { alert(\"second success\"); })\n.error(function() { alert(\"error\"); })\n.complete(function() { alert(\"complete\"); });\n\n\/\/ perform other work here ...\n\n\/\/ Set another completion function for the request above\njqxhr.complete(function(){ alert(\"second complete\"); });<\/pre>\n  ","categories":["Ajax > Shorthand Methods","Version > Version 1.0","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.getScript\/","name":"jQuery.getScript","title":"jQuery.getScript()","type":"method","signatures":[{"added":"1.0","params":[{"name":"url","type":"String","optional":"","desc":"A string containing the URL to which the request is sent."},{"name":"success(script, textStatus, jqXHR)","type":"Function","optional":"optional","desc":"A callback function that is executed if the request succeeds."}]}],"desc":"Load a JavaScript file from the server using a GET HTTP request, then execute it.","longdesc":"<p>This is a shorthand Ajax function, which is equivalent to:<\/p>\n<pre>$.ajax({\n  url: <em>url<\/em>,\n  dataType: \"script\",\n  success: <em>success<\/em>\n});\n<\/pre>\n        <p>The script is executed in the global context, so it can refer to other variables and use jQuery functions. Included scripts can have some impact on the current page.<\/p>\n        <h4 id=\"success-callback\">\n          Success Callback\n        <\/h4>\n        <p>The callback is passed the returned JavaScript file. This is generally not useful as the script will already have run at this point.<\/p>\n        <pre>$(\".result\").html(\"&lt;p&gt;Lorem ipsum dolor sit amet.&lt;\/p&gt;\");<\/pre>\n        <p>Scripts are included and run by referencing the file name:<\/p>\n<pre>$.getScript(\"ajax\/test.js\", function(data, textStatus, jqxhr) {\n   console.log(data); \/\/data returned\n   console.log(textStatus); \/\/success\n   console.log(jqxhr.status); \/\/200\n   console.log('Load was performed.');\n});<\/pre>\n\n        <h4 id=\"handling-errors\">Handling Errors<\/h4>\n        <p>As of jQuery 1.5, you may use <a href=\"http:\/\/api.jquery.com\/deferred.fail\/\"><code>.fail()<\/code><\/a> to account for errors:<\/p>\n<pre>\n$.getScript(\"ajax\/test.js\")\n.done(function(script, textStatus) {\n  console.log( textStatus );\n})\n.fail(function(jqxhr, settings, exception) {\n  $( \"div.log\" ).text( \"Triggered ajaxError handler.\" );\n});  \n<\/pre>\n        <p>Prior to jQuery 1.5, the global <code>.ajaxError()<\/code> callback event had to be used in order to handle <code>$.getScript()<\/code> errors:<\/p>\n<pre>\n$( \"div.log\" ).ajaxError(function(e, jqxhr, settings, exception) {\n  if (settings.dataType=='script') {\n    $(this).text( \"Triggered ajaxError handler.\" );\n  }\n});\n<\/pre>\n        <h4 id=\"caching-requests\">Caching Responses<\/h4>\n        <p>Be default, <code>$.getScript()<\/code> sets the cache setting to <code>false<\/code>. This appends a timestamped query parameter to the request URL to ensure that the browser downloads the script each time it is requested. You can override this feature by setting the cache property globally using <a href=\"http:\/\/api.jquery.com\/jquery.ajaxsetup\/\"><code>$.ajaxSetup()<\/code><\/a>: <\/p>\n<pre>\n$.ajaxSetup({\n  cache: true\n});\n<\/pre>\n        <p>Alternatively, you could define a new method that uses the more flexible <code>$.ajax()<\/code> method.<\/p>\n","categories":["Ajax > Shorthand Methods","Version > Version 1.0","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.globalEval\/","name":"jQuery.globalEval","title":"jQuery.globalEval()","type":"method","signatures":[{"added":"1.0.4","params":[{"name":"code","type":"String","optional":"","desc":"The JavaScript code to execute."}]}],"desc":"Execute some JavaScript code globally.","longdesc":"<p>This method behaves differently from using a normal JavaScript <code>eval()<\/code> in that it's executed within the global context (which is important for loading external scripts dynamically).<\/p>","categories":["Utilities","Version > Version 1.0.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.grep\/","name":"jQuery.grep","title":"jQuery.grep()","type":"method","signatures":[{"added":"1.0","params":[{"name":"array","type":"Array","optional":"","desc":"The array to search through."},{"name":"function(elementOfArray, indexInArray)","type":"Function","optional":"","desc":"The function to process each item against.  The first argument to the function is the item, and the second argument is the index.  The function should return a Boolean value.  <code>this<\/code> will be the global window object."},{"name":"invert","type":"Boolean","optional":"optional","desc":"If \"invert\" is false, or not provided, then the function returns an array consisting of all elements for which \"callback\" returns true.  If \"invert\" is true, then the function returns an array consisting of all elements for which \"callback\" returns false."}]}],"desc":"Finds the elements of an array which satisfy a filter function. The original array is not affected.","longdesc":"<p>The <code>$.grep()<\/code> method removes items from an array as necessary so that all remaining items pass a provided test. The test is a function that is passed an array item and the index of the item within the array. Only if the test returns true will the item be in the result array.<\/p>\n\n  <p> The filter function will be passed two arguments: the current array item and its index. The filter function must return 'true' to include the item in the result array.<\/p>\n","categories":["Utilities","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.hasData\/","name":"jQuery.hasData","title":"jQuery.hasData()","type":"method","signatures":[{"added":"1.5","params":[{"name":"element","type":"Element","optional":"","desc":"A DOM element to be checked for data."}]}],"desc":"Determine whether an element has any jQuery data associated with it.","longdesc":"<p>The <code>jQuery.hasData()<\/code> method provides a way to determine if an element currently has any values that were set using <code><a href=\"\/jQuery.data\">jQuery.data()<\/a><\/code>. If no data is associated with an element (there is no data object at all or the data object is empty), the method returns <code>false<\/code>; otherwise it returns <code>true<\/code>.<\/p>\n<p>The primary advantage of <code>jQuery.hasData(element)<\/code> is that it does not create and associate a data object with the element if none currently exists. In contrast, <code>jQuery.data(element)<\/code> always returns a data object to the caller, creating one if no data object previously existed.\n<\/p>\n<p>Note that jQuery's event system uses the jQuery data API to store event handlers. Therefore, binding an event to an element using <code>.on()<\/code>, <code>.bind()<\/code>, <code>.live()<\/code>, <code>.delegate()<\/code>, or one of the shorthand event methods also associates a data object with that element.\n<\/p>\n","categories":["Data","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.holdReady\/","name":"jQuery.holdReady","title":"jQuery.holdReady()","type":"method","signatures":[{"added":"1.6","params":[{"name":"hold","type":"Boolean","optional":"","desc":"Indicates whether the ready hold is being requested or released"}]}],"desc":"Holds or releases the execution of jQuery's ready event.","longdesc":"\n<p>The <code>$.holdReady()<\/code> method allows the caller to delay jQuery's ready event. This <em>advanced feature<\/em> would typically be used by dynamic script loaders that want to load additional JavaScript such as jQuery plugins before allowing the ready event to occur, even though the DOM may be ready. This method must be called early in the document, such as in the <code>&lt;head&gt;<\/code> immediately after the jQuery script tag. Calling this method after the ready event has already fired will have no effect. <\/p>\n<p>To delay the ready event, first call <code>$.holdReady(true)<\/code>. When the ready event should be released to execute, call <code>$.holdReady(false)<\/code>. Note that multiple holds can be put on the ready event, one for each <code>$.holdReady(true)<\/code> call. The ready event will not actually fire until all holds have been released with a corresponding number of <code>$.holdReady(false)<\/code> calls <em>and<\/em> the normal document ready conditions are met. (See <a href=\"http:\/\/api.jquery.com\/ready\/\"><code>ready<\/code><\/a> for more information.)<\/p>\n","categories":["Core","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.inArray\/","name":"jQuery.inArray","title":"jQuery.inArray()","type":"method","signatures":[{"added":"1.2","params":[{"name":"value","type":"Any","optional":"","desc":"The value to search for."},{"name":"array","type":"Array","optional":"","desc":"An array through which to search."},{"name":"fromIndex","type":"Number","optional":"optional","desc":"The index of the array at which to begin the search. The default is 0, which will search the whole array."}]}],"desc":"Search for a specified value within an array and return its index (or -1 if not found).","longdesc":"<p>The <code>$.inArray()<\/code> method is similar to JavaScript's native <code>.indexOf()<\/code> method in that it returns -1 when it doesn't find a match. If the first element within the array matches <code>value<\/code>, <code>$.inArray()<\/code> returns 0.<\/p> \n\n    <p>Because JavaScript treats 0 as loosely equal to false (i.e. 0 == false, but 0 !== false), if we're checking for the presence of <code>value<\/code> within <code>array<\/code>, we need to check if it's not equal to (or greater than) -1.<\/p>\n  ","categories":["Utilities","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.isArray\/","name":"jQuery.isArray","title":"jQuery.isArray()","type":"method","signatures":[{"added":"1.3","params":[{"name":"obj","type":"Object","optional":"","desc":"Object to test whether or not it is an array."}]}],"desc":"Determine whether the argument is an array.","longdesc":"<p><code>$.isArray()<\/code> returns a Boolean indicating whether the object is a JavaScript array (not an array-like object, such as a jQuery object).<\/p>","categories":["Utilities","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.isEmptyObject\/","name":"jQuery.isEmptyObject","title":"jQuery.isEmptyObject()","type":"method","signatures":[{"added":"1.4","params":[{"name":"object","type":"Object","optional":"","desc":"The object that will be checked to see if it's empty."}]}],"desc":"Check to see if an object is empty (contains no properties).","longdesc":"<p>As of jQuery 1.4 this method checks both properties on the object itself and properties inherited from prototypes (in that it doesn't use hasOwnProperty). The argument should always be a plain JavaScript <code>Object<\/code> as other types of object (DOM elements, primitive strings\/numbers, host objects) may not give consistent results across browsers. To determine if an object is a plain JavaScript object, use <a href=\"http:\/\/api.jquery.com\/jQuery.isPlainObject\"><code>$.isPlainObject()<\/code><\/a><\/p>","categories":["Utilities","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.isFunction\/","name":"jQuery.isFunction","title":"jQuery.isFunction()","type":"method","signatures":[{"added":"1.2","params":[{"name":"obj","type":"Object","optional":"","desc":"Object to test whether or not it is a function."}]}],"desc":"Determine if the argument passed is a Javascript function object. ","longdesc":"<p><strong>Note:<\/strong> As of jQuery 1.3, functions provided by the browser like <code>alert()<\/code> and DOM element methods like <code>getAttribute()<\/code> are not guaranteed to be detected as functions in browsers such as Internet Explorer.<\/p>","categories":["Utilities","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.isNumeric\/","name":"jQuery.isNumeric","title":"jQuery.isNumeric()","type":"method","signatures":[{"added":"1.7","params":[{"name":"value","type":"Object","optional":"","desc":"The value to be tested."}]}],"desc":"Determines whether its argument is a number.","longdesc":"\n<p>The <code>$.isNumeric()<\/code> method checks whether its argument represents a numeric value. If so, it returns <code>true<\/code>. Otherwise it returns <code>false<\/code>. The argument can be of any type.<\/p>\n","categories":["Utilities","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.isPlainObject\/","name":"jQuery.isPlainObject","title":"jQuery.isPlainObject()","type":"method","signatures":[{"added":"1.4","params":[{"name":"object","type":"Object","optional":"","desc":"The object that will be checked to see if it's a plain object."}]}],"desc":"Check to see if an object is a plain object (created using \"{}\" or \"new Object\").","longdesc":"<p><strong>Note:<\/strong> Host objects (or objects used by browser host environments to complete the execution environment of ECMAScript) have a number of inconsistencies which are difficult to robustly feature detect cross-platform. As a result of this,  <code>$.isPlainObject()<\/code> may evaluate inconsistently across browsers in certain instances.<\/p><p>An example of this is a test against <code>document.location<\/code> using <code>$.isPlainObject()<\/code> as follows:<\/p><pre>\nconsole.log($.isPlainObject(document.location));\n<\/pre>\n<p>which throws an invalid pointer exception in IE8. With this in mind, it's important to be aware of any of the gotchas involved in using <code>$.isPlainObject()<\/code> against older browsers. Some basic example of use-cases that do function correctly cross-browser can be found below.<\/p>\n","categories":["Utilities","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.isWindow\/","name":"jQuery.isWindow","title":"jQuery.isWindow()","type":"method","signatures":[{"added":"1.4.3","params":[{"name":"obj","type":"Object","optional":"","desc":"Object to test whether or not it is a window."}]}],"desc":"Determine whether the argument is a window.","longdesc":"<p>This is used in a number of places in jQuery to determine if we're operating against a browser window (such as the current window or an iframe).<\/p>","categories":["Utilities","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.isXMLDoc\/","name":"jQuery.isXMLDoc","title":"jQuery.isXMLDoc()","type":"method","signatures":[{"added":"1.1.4","params":[{"name":"node","type":"Element","optional":"","desc":"The DOM node that will be checked to see if it's in an XML document."}]}],"desc":"Check to see if a DOM node is within an XML document (or is an XML document).","longdesc":"<longdesc\/>","categories":["Utilities","Version > Version 1.1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.makeArray\/","name":"jQuery.makeArray","title":"jQuery.makeArray()","type":"method","signatures":[{"added":"1.2","params":[{"name":"obj","type":"Object","optional":"","desc":"Any object to turn into a native Array."}]}],"desc":"Convert an array-like object into a true JavaScript array.","longdesc":"\n    <p>Many methods, both in jQuery and in JavaScript in general, return objects that are array-like. For example, the jQuery factory function <code>$()<\/code> returns a jQuery object that has many of the properties of an array (a length, the <code>[]<\/code> array access operator, etc.), but is not exactly the same as an array and lacks some of an array's built-in methods (such as <code>.pop()<\/code> and <code>.reverse()<\/code>).<\/p>\n\n    <p>Note that after the conversion, any special features the object had (such as the jQuery methods in our example) will no longer be present. The object is now a plain array.<\/p>","categories":["Utilities","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.map\/","name":"jQuery.map","title":"jQuery.map()","type":"method","signatures":[{"added":"1.0","params":[{"name":"array","type":"Array","optional":"","desc":"The Array to translate."},{"name":"callback(elementOfArray, indexInArray)","type":"Function","optional":"","desc":"The function to process each item against.  The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, <code>this<\/code> refers to the global (window) object."}]},{"added":"1.6","params":[{"name":"arrayOrObject","type":"Array,Object","optional":"","desc":"The Array or Object to translate."},{"name":"callback( value, indexOrKey )","type":"Function","optional":"","desc":"The function to process each item against.  The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, <code>this<\/code> refers to the global (window) object. "}]}],"desc":"Translate all items in an array or object to new array of items.","longdesc":"\n  <p>The <code>$.map()<\/code> method applies a function to each item in an array or object and maps the results into a new array. <strong>Prior to jQuery 1.6<\/strong>, <code>$.map()<\/code> supports traversing <em>arrays only<\/em>. <strong>As of jQuery 1.6<\/strong> it also traverses objects.<\/p>\n   <p>Array-like objects \u2014 those with a <code>.length<\/code> property <em>and<\/em> a value on the <code>.length - 1<\/code> index \u2014 must be converted to actual arrays before being passed to <code>$.map()<\/code>. The jQuery library provides <a href=\"http:\/\/api.jquery.com\/jQuery.makeArray\/\">$.makeArray()<\/a> for such conversions.<\/p>\n<pre class=\"prettyprint\">\n\/\/ The following object masquerades as an array.\nvar fakeArray = {\"length\": 1, 0: \"Addy\", 1: \"Subtracty\"};\n\n\/\/ Therefore, convert it to a real array\nvar realArray = $.makeArray( fakeArray )\n\n\/\/ Now it can be used reliably with $.map()\n$.map( realArray, function(val, i) {\n  \/\/ do something \n});\n<\/pre>\n    <p>The translation function that is provided to this method is called for each top-level element in the array or object and is passed two arguments: The element's value and its index or key within the array or object.<\/p>\n    <p>The function can return:<\/p>\n    <ul>\n      <li>the translated value, which will be mapped to the resulting array<\/li>\n      <li><code>null<\/code> or <code>undefined<\/code>, to remove the item<\/li>\n      <li>an array of values, which will be flattened into the full array<\/li>\n    <\/ul>\n   ","categories":["Utilities","Version > Version 1.0","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.merge\/","name":"jQuery.merge","title":"jQuery.merge()","type":"method","signatures":[{"added":"1.0","params":[{"name":"first","type":"Array","optional":"","desc":"The first array to merge, the elements of second added."},{"name":"second","type":"Array","optional":"","desc":"The second array to merge into the first, unaltered."}]}],"desc":"Merge the contents of two arrays together into the first array. ","longdesc":"<p>The <code>$.merge()<\/code> operation forms an array that contains all elements from the two arrays. The orders of items in the arrays are preserved, with items from the second array appended. The <code>$.merge()<\/code> function is destructive. It alters the first parameter to add the items from the second.  <\/p>\n    <p>If you need the original first array, make a copy of it before calling <code>$.merge()<\/code>. Fortunately, <code>$.merge()<\/code> itself can be used for this duplication:<\/p>\n    <pre>var newArray = $.merge([], oldArray);<\/pre>\n    <p>This shortcut creates a new, empty array and merges the contents of oldArray into it, effectively cloning the array.<\/p>\n    <p>Prior to jQuery 1.4, the arguments should be true Javascript Array objects; use <code>$.makeArray<\/code> if they are not.<\/p>","categories":["Utilities","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.noConflict\/","name":"jQuery.noConflict","title":"jQuery.noConflict()","type":"method","signatures":[{"added":"1.0","params":[{"name":"removeAll","type":"Boolean","optional":"optional","desc":"A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself)."}]}],"desc":"Relinquish jQuery's control of the <code>$<\/code> variable.","longdesc":"<p>Many JavaScript libraries use <code> $<\/code> as a function or variable name, just as jQuery does. In jQuery's case, <code> $<\/code> is just an alias for <code>jQuery<\/code>, so all functionality is available without using <code> $<\/code>. If we need to use another JavaScript library alongside jQuery, we can return control of <code> $<\/code> back to the other library with a call to <code>$.noConflict()<\/code>:<\/p>\n<pre>\n&lt;script type=\"text\/javascript\" src=\"other_lib.js\"&gt;&lt;\/script&gt;\n&lt;script type=\"text\/javascript\" src=\"jquery.js\"&gt;&lt;\/script&gt;\n&lt;script type=\"text\/javascript\"&gt;\n  $.noConflict();\n  \/\/ Code that uses other library's $ can follow here.\n&lt;\/script&gt;\n<\/pre>\n<p>This technique is especially effective in conjunction with the .ready() method's ability to alias the jQuery object, as within callback passed to .ready() we can use $ if we wish without fear of conflicts later:<\/p>\n<pre>\n&lt;script type=\"text\/javascript\" src=\"other_lib.js\"&gt;&lt;\/script&gt;\n&lt;script type=\"text\/javascript\" src=\"jquery.js\"&gt;&lt;\/script&gt;\n&lt;script type=\"text\/javascript\"&gt;\n  $.noConflict();\n  jQuery(document).ready(function($) {\n    \/\/ Code that uses jQuery's $ can follow here.\n  });\n  \/\/ Code that uses other library's $ can follow here.\n&lt;\/script&gt;\n<\/pre>\n<p>If necessary, we can free up the <code> jQuery<\/code> name as well by passing <code>true<\/code> as an argument to the method. This is rarely necessary, and if we must do this (for example, if we need to use multiple versions of the <code>jQuery<\/code> library on the same page), we need to consider that most plug-ins rely on the presence of the jQuery variable and may not operate correctly in this situation.<\/p>\n","categories":["Core","Miscellaneous > Setup Methods","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.noop\/","name":"jQuery.noop","title":"jQuery.noop()","type":"method","signatures":[{"added":"1.4"}],"desc":"An empty function.","longdesc":"<p>You can use this empty function when you wish to pass around a function that will do nothing.<\/p>\n<p>This is useful for plugin authors who offer optional callbacks; in the case that no callback is given, something like <code>jQuery.noop<\/code> could execute.<\/p>","categories":["Utilities","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.now\/","name":"jQuery.now","title":"jQuery.now()","type":"method","signatures":[{"added":"1.4.3"}],"desc":"Return a number representing the current time.","longdesc":"\n    <p>The <code>$.now()<\/code> method is a shorthand for the number returned by the expression <code>(new Date).getTime()<\/code>.<\/p>\n  ","categories":["Utilities","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.param\/","name":"jQuery.param","title":"jQuery.param()","type":"method","signatures":[{"added":"1.2","params":[{"name":"obj","type":"Array, Object","optional":"","desc":"An array or object to serialize."}]},{"added":"1.4","params":[{"name":"obj","type":"Array, Object","optional":"","desc":"An array or object to serialize."},{"name":"traditional","type":"Boolean","optional":"","desc":"A Boolean indicating whether to perform a traditional \"shallow\" serialization."}]}],"desc":"Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. ","longdesc":"\n    <p>This function is used internally to convert form element values into a serialized string representation (See <a href=\"\/serialize\/\">.serialize()<\/a> for more information).<\/p>\n\n    <p>As of jQuery 1.3, the return value of a function is used instead of the function as a String.<\/p>\n\n    <p>As of jQuery 1.4, the <code>$.param()<\/code> method serializes deep objects recursively to accommodate modern scripting languages and frameworks such as PHP and Ruby on Rails. You can disable this functionality globally by setting <code>jQuery.ajaxSettings.traditional = true;<\/code>.<\/p>\n<p>If the object passed is in an Array, it must be an array of objects in the format returned by <a href=\"\/serializeArray\/\">.serializeArray()<\/a><\/p> \n<pre>[{name:\"first\",value:\"Rick\"},\n{name:\"last\",value:\"Astley\"},\n{name:\"job\",value:\"Rock Star\"}]<\/pre>\n<blockquote>\n    <p><strong>Note:<\/strong> Because some frameworks have limited ability to parse serialized arrays, developers should exercise caution when passing an <code>obj<\/code> argument that contains objects or arrays nested within another array.<\/p>\n<\/blockquote>\n<blockquote>\n<p><strong>Note:<\/strong> Because there is no universally agreed-upon specification for param strings, it is not possible to encode complex data structures using this method in a manner that works ideally across all languages supporting such input. Until such time that there is, the <code>$.param<\/code> method will remain in its current form.<\/p>\n<\/blockquote>\n<p>In jQuery 1.4, HTML5 input elements are also serialized.<\/p>\n    <p>We can display a query string representation of an object and a URI-decoded version of the same as follows:<\/p>\n<pre>var myObject = {\n  a: {\n    one: 1, \n    two: 2, \n    three: 3\n  }, \n  b: [1,2,3]\n};\nvar recursiveEncoded = $.param(myObject);\nvar recursiveDecoded = decodeURIComponent($.param(myObject));\n\nalert(recursiveEncoded);\nalert(recursiveDecoded);\n<\/pre>\n  <p>The values of <code>recursiveEncoded<\/code> and <code>recursiveDecoded<\/code> are alerted as follows:<\/p>\n<p><span class=\"output\">a%5Bone%5D=1&amp;a%5Btwo%5D=2&amp;a%5Bthree%5D=3&amp;b%5B%5D=1&amp;b%5B%5D=2&amp;b%5B%5D=3<\/span><br\/>\n<span class=\"output\">a[one]=1&amp;a[two]=2&amp;a[three]=3&amp;b[]=1&amp;b[]=2&amp;b[]=3<\/span><\/p>\n    <p>To emulate the behavior of <code>$.param()<\/code> prior to jQuery 1.4, we can set the <code>traditional<\/code> argument to <code>true<\/code>:<\/p>\n<pre>var myObject = {\n  a: {\n    one: 1, \n    two: 2, \n    three: 3\n  }, \n  b: [1,2,3]\n};\nvar shallowEncoded = $.param(myObject, true);\nvar shallowDecoded = decodeURIComponent(shallowEncoded);\n\nalert(shallowEncoded);\nalert(shallowDecoded);\n<\/pre>\n<p>The values of <code>shallowEncoded<\/code> and <code>shallowDecoded<\/code> are alerted as follows:<\/p>\n<p><span class=\"output\">a=%5Bobject+Object%5D&amp;b=1&amp;b=2&amp;b=3<\/span><br\/>\n<span class=\"output\">a=[object+Object]&amp;b=1&amp;b=2&amp;b=3<\/span><\/p>\n  ","categories":["Miscellaneous > Collection Manipulation","Forms","Ajax > Helper Functions","Version > Version 1.2","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.parseJSON\/","name":"jQuery.parseJSON","title":"jQuery.parseJSON","type":"method","signatures":[{"added":"1.4.1","params":[{"name":"json","type":"String","optional":"","desc":"The JSON string to parse."}]}],"desc":"Takes a well-formed JSON string and returns the resulting JavaScript object.","longdesc":"<p>Passing in a malformed JSON string may result in an exception being thrown. For example, the following are all malformed JSON strings:<\/p>\n<ul>\n<li><code>{test: 1}<\/code> (test does not have double quotes around it).<\/li>\n<li><code>{'test': 1}<\/code> ('test' is using single quotes instead of double quotes).<\/li>\n<\/ul>\n<p>Additionally if you pass in nothing, an empty string, null, or undefined, 'null' will be returned from parseJSON. Where the browser provides a native implementation of <code>JSON.parse<\/code>, jQuery uses it to parse the string. For details on the JSON format, see <a href=\"http:\/\/json.org\/\">http:\/\/json.org\/<\/a>.\n<\/p>","categories":["Utilities","Version > Version 1.4.1"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.parseXML\/","name":"jQuery.parseXML","title":"jQuery.parseXML()","type":"method","signatures":[{"added":"1.5","params":[{"name":"data","type":"String","optional":"","desc":"a well-formed XML string to be parsed"}]}],"desc":"Parses a string into an XML document.","longdesc":"\n<p><code>jQuery.parseXML<\/code> uses the native parsing function of the browser to create a valid XML Document. This document can then be passed to <code>jQuery<\/code> to create a typical jQuery object that can be traversed and manipulated.<\/p>\n","categories":["Utilities","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.post\/","name":"jQuery.post","title":"jQuery.post()","type":"method","signatures":[{"added":"1.0","params":[{"name":"url","type":"String","optional":"","desc":"A string containing the URL to which the request is sent."},{"name":"data","type":"Map, String","optional":"optional","desc":"A map or string that is sent to the server with the request."},{"name":"success(data, textStatus, jqXHR)","type":"Function","optional":"optional","desc":"A callback function that is executed if the request succeeds."},{"name":"dataType","type":"String","optional":"optional","desc":"The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html)."}]}],"desc":"Load data from the server using a HTTP POST request.","longdesc":"<p>This is a shorthand Ajax function, which is equivalent to:<\/p>\n    <pre>$.ajax({\n  type: 'POST',\n  url: <em>url<\/em>,\n  data: <em>data<\/em>,\n  success: <em>success<\/em>,\n  dataType: <em>dataType<\/em>\n});\n<\/pre>\n  <p>The <code>success<\/code> callback function is passed the returned data, which will be an XML root element or a text string depending on the MIME type of the response. It is also passed the text status of the response.<\/p>\n  <p><strong>As of jQuery 1.5<\/strong>, the <code>success<\/code> callback function is also passed a <a href=\"http:\/\/api.jquery.com\/jQuery.get\/#jqxhr-object\">\"jqXHR\" object<\/a> (in <strong>jQuery 1.4<\/strong>, it was passed the <code>XMLHttpRequest<\/code> object).<\/p>\n  <p>Most implementations will specify a success handler:<\/p>\n  <pre>$.post('ajax\/test.html', function(data) {\n  $('.result').html(data);\n});\n<\/pre>\n    <p>This example fetches the requested HTML snippet and inserts it on the page.<\/p>\n    <p>Pages fetched with <code>POST<\/code> are never cached, so the <code>cache<\/code> and <code>ifModified<\/code> options in <code><a href=\"\/jQuery.ajaxSetup\">jQuery.ajaxSetup()<\/a><\/code> have no effect on these requests.<\/p>\n    <h4 id=\"jqxhr-object\">The jqXHR Object<\/h4>\n    <p><strong>As of jQuery 1.5<\/strong>, all of jQuery's Ajax methods return  a superset of the <code>XMLHTTPRequest<\/code> object. This jQuery XHR object, or \"jqXHR,\" returned by <code>$.post()<\/code> implements the Promise interface, giving it all the properties, methods, and behavior of a Promise (see <a href=\"http:\/\/api.jquery.com\/category\/deferred-object\/\">Deferred object<\/a> for more information). For convenience and consistency with the callback names used by <code><a href=\"http:\/\/api.jquery.com\/jQuery.ajax\/\">$.ajax()<\/a><\/code>, it provides <code>.error()<\/code>, <code>.success()<\/code>, and <code>.complete()<\/code> methods. These methods take a function argument that is called when the request terminates, and the function receives the same arguments as the correspondingly-named <code>$.ajax()<\/code> callback.<\/p>\n\n    <p>The Promise interface in jQuery 1.5 also allows jQuery's Ajax methods, including <code>$.post()<\/code>, to chain multiple <code>.success()<\/code>, <code>.complete()<\/code>, and <code>.error()<\/code> callbacks on a single request, and even to assign these callbacks after the request may have completed. If the request is already complete, the callback is fired immediately.<\/p>\n    <pre>\/\/ Assign handlers immediately after making the request,\n    \/\/ and remember the jqxhr object for this request\n    var jqxhr = $.post(\"example.php\", function() {\n      alert(\"success\");\n    })\n    .success(function() { alert(\"second success\"); })\n    .error(function() { alert(\"error\"); })\n    .complete(function() { alert(\"complete\"); });\n\n    \/\/ perform other work here ...\n\n    \/\/ Set another completion function for the request above\n    jqxhr.complete(function(){ alert(\"second complete\"); });<\/pre>\n\t\t","categories":["Ajax > Shorthand Methods","Version > Version 1.0","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.proxy\/","name":"jQuery.proxy","title":"jQuery.proxy()","type":"method","signatures":[{"added":"1.4","params":[{"name":"function","type":"Function","optional":"","desc":"The function whose context will be changed."},{"name":"context","type":"Object","optional":"","desc":"The object to which the context (<code>this<\/code>) of the function should be set."}]},{"added":"1.4","params":[{"name":"context","type":"Object","optional":"","desc":"The object to which the context of the function should be set."},{"name":"name","type":"String","optional":"","desc":"The name of the function whose context will be changed (should be a property of the <code>context<\/code> object)."}]}],"desc":"Takes a function and returns a new one that will always have a particular context.","longdesc":"<p>This method is most useful for attaching event handlers to an element where the context is pointing back to a different object. Additionally, jQuery makes sure that even if you bind the function returned from <code>jQuery.proxy()<\/code> it will still unbind the correct function if passed the original.<\/p>\n<p>Be aware, however, that jQuery's event binding subsystem assigns a unique id to each event handling function in order to track it when it is used to specify the function to be unbound. The function represented by <code>jQuery.proxy()<\/code> is seen as a single function by the event subsystem, even when it is used to bind different contexts. To avoid unbinding the wrong handler, use a unique event namespace for binding and unbinding (e.g., <code>\"click.myproxy1\"<\/code>) rather than specifying the proxied function during unbinding.\n<\/p>","categories":["Events > Event Handler Attachment","Utilities","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.queue\/","name":"jQuery.queue","title":"jQuery.queue()","type":"method","signatures":[{"added":"1.3","params":[{"name":"element","type":"Element","optional":"","desc":"A DOM element to inspect for an attached queue."},{"name":"queueName","type":"String","optional":"optional","desc":"A string containing the name of the queue. Defaults to <code>fx<\/code>, the standard effects queue."}]}],"desc":"Show the queue of functions to be executed on the matched element.","longdesc":"<p><strong>Note:<\/strong> This is a low-level method, you should probably use <code><a href=\"\/queue\">.queue()<\/a><\/code> instead.<\/p>","categories":["Data","Utilities","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.queue\/","name":"jQuery.queue","title":"jQuery.queue()","type":"method","signatures":[{"added":"1.3","params":[{"name":"element","type":"Element","optional":"","desc":"A DOM element where the array of queued functions is attached."},{"name":"queueName","type":"String","optional":"","desc":"A string containing the name of the queue. Defaults to <code>fx<\/code>, the standard effects queue."},{"name":"newQueue","type":"Array","optional":"","desc":"An array of functions to replace the current queue contents."}]},{"added":"1.3","params":[{"name":"element","type":"Element","optional":"","desc":"A DOM element on which to add a queued function."},{"name":"queueName","type":"String","optional":"","desc":"A string containing the name of the queue. Defaults to <code>fx<\/code>, the standard effects queue."},{"name":"callback()","type":"Function","optional":"","desc":"The new function to add to the queue."}]}],"desc":"Manipulate the queue of functions to be executed on the matched element.","longdesc":"<p><strong>Note:<\/strong> This is a low-level method, you should probably use <code><a href=\"\/queue\">.queue()<\/a><\/code> instead.<\/p>\n\t<p>Every element can have one or more queues of functions attached to it by jQuery. In most applications, only one queue (called <code>fx<\/code>) is used. Queues allow a sequence of actions to be called on an element asynchronously, without halting program execution.<\/p>\n\t<p>The <code>jQuery.queue()<\/code> method allows us to directly manipulate this queue of functions. Calling <code>jQuery.queue()<\/code> with a callback is particularly useful; it allows us to place a new function at the end of the queue.<\/p>\n\t<p>Note that when adding a function with <code>jQuery.queue()<\/code>, we should ensure that <code>jQuery.dequeue()<\/code> is eventually called so that the next function in line executes.<\/p>","categories":["Data","Utilities","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.removeData\/","name":"jQuery.removeData","title":"jQuery.removeData()","type":"method","signatures":[{"added":"1.2.3","params":[{"name":"element","type":"Element","optional":"","desc":"A DOM element from which to remove data."},{"name":"name","type":"String","optional":"optional","desc":"A string naming the piece of data to remove."}]}],"desc":"Remove a previously-stored piece of data.","longdesc":"<p><strong>Note:<\/strong> This is a low-level method, you should probably use <code><a href=\"\/removeData\">.removeData()<\/a><\/code> instead.<\/p>\n\t<p>The <code>jQuery.removeData()<\/code> method allows us to remove values that were previously set using <code><a href=\"\/jQuery.data\">jQuery.data()<\/a><\/code>. When called with the name of a key, <code>jQuery.removeData()<\/code> deletes that particular value; when called with no arguments, all values are removed.<\/p>","categories":["Data","Utilities","Version > Version 1.2.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.sub\/","name":"jQuery.sub","title":"jQuery.sub()","type":"method","signatures":[{"added":"1.5"}],"desc":"Creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object.","longdesc":"<p><strong>This method is deprecated as of jQuery 1.7 and will be moved to a plugin in jQuery 1.8.<\/strong><\/p>\n<p>There are two specific use cases for which jQuery.sub() was created. The first was for providing a painless way of overriding jQuery methods without completely destroying the original methods and another was for helping to do encapsulation and basic namespacing for jQuery plugins.<\/p>\n<p>Note that jQuery.sub() doesn't attempt to do any sort of isolation - that's not its intention. All the methods on the sub'd version of jQuery will still point to the original jQuery (events bound and triggered will still be through the main jQuery, data will be bound to elements through the main jQuery, Ajax queries and events will run through the main jQuery, etc.).<\/p>\n<p>Note that if you're looking to use this for plugin development you should first <i>strongly<\/i> consider using something like the jQuery UI widget factory which manages both state and plugin sub-methods. <a href=\"http:\/\/blog.nemikor.com\/2010\/05\/15\/building-stateful-jquery-plugins\/\">Some examples of using the jQuery UI widget factory<\/a> to build a plugin.<\/p>\n<p>The particular use cases of this method can be best described through some examples.<\/p>","categories":["Core","Deprecated","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.support\/","name":"jQuery.support","title":"jQuery.support","type":"property","signatures":[{"added":"1.3"}],"desc":"A collection of properties that represent the presence of different browser features or bugs. Primarily intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance.","longdesc":"\n    <p>Rather than using <code>$.browser<\/code> to detect the current user agent and alter the page presentation based on which browser is running, it is a good practice to use <strong>feature detection<\/strong>. To make this process simpler, jQuery performs many such tests and sets properties of the <code>jQuery.support<\/code> object.<\/p>\n    <p><strong>Since jQuery requires these tests internally, they must be performed on <em>every<\/em> page load. Although some of these properties are documented below, they are not subject to a long deprecation\/removal cycle and may be removed once internal jQuery code no longer needs them.<\/strong><\/p>\n\n<blockquote>\n    <p>Following are a few resources that explain how feature detection works:<\/p>\n    <ul>\n      <li><a href=\"http:\/\/peter.michaux.ca\/articles\/feature-detection-state-of-the-art-browser-scripting\">http:\/\/peter.michaux.ca\/articles\/feature-detection-state-of-the-art-browser-scripting<\/a><\/li>\n      <li><a href=\"http:\/\/www.jibbering.com\/faq\/faq_notes\/not_browser_detect.html\">http:\/\/www.jibbering.com\/faq\/faq_notes\/not_browser_detect.html<\/a><\/li>\n      <li><a href=\"http:\/\/yura.thinkweb2.com\/cft\/\">http:\/\/yura.thinkweb2.com\/cft\/<\/a><\/li>\n    <\/ul>\n<\/blockquote>\n    <p>For your own project's feature-detection needs, we strongly recommend the use of an external library such as <a href=\"http:\/\/modernizr.com\">Modernizr<\/a> instead of dependency on properties in <code>jQuery.support<\/code>.<\/p>\n\n<p>The tests included in <code>jQuery.support<\/code> are as follows:<\/p>\n<ul>\n  <li><code>ajax<\/code> is equal to true if a browser is able to create an <code>XMLHttpRequest<\/code> object.<\/li>\n<li><code>boxModel<\/code> is equal to true if the page is rendering according to the <a href=\"http:\/\/www.w3.org\/TR\/REC-CSS2\/box.html\">W3C CSS Box Model<\/a> (is currently false in IE 6 and 7 when they are in Quirks Mode). This property is null until document ready occurs.<\/li>\n<li><code>changeBubbles<\/code> is equal to true if the change event bubbles up the DOM tree, as required by the <a href=\"http:\/\/www.w3.org\/TR\/DOM-Level-2-Events\/events.html#Events-eventgroupings-htmlevents\">W3C DOM event model<\/a>. (It is currently false in IE, and jQuery simulates bubbling).<\/li>\n<li><code>checkClone<\/code> is equal to true if a browser correctly clones the checked state of radio buttons or checkboxes in document fragments.<\/li>\n<li><code>checkOn<\/code> is equal to true if the value of a checkbox defaults to \"on\" when no value is specified.<\/li>\n<li><code>cors<\/code> is equal to true if a browser can create an <code>XMLHttpRequest<\/code> object and if that <code>XMLHttpRequest<\/code> object has a <code>withCredentials<\/code> property. To enable cross-domain requests in environments that do not support cors yet but do allow cross-domain <abbr title=\"XMLHttpRequest\">XHR<\/abbr> requests (windows gadget, etc), set <code>$.support.cors = true;<\/code>.\n<a href=\"http:\/\/www.w3.org\/TR\/cors\/\">CORS WD<\/a><\/li>\n<li><code>cssFloat<\/code> is equal to true if the name of the property containing the CSS float value is .cssFloat, as defined in the <a href=\"http:\/\/www.w3.org\/TR\/DOM-Level-2-Style\/css.html#CSS-CSS2Properties-cssFloat\">CSS Spec<\/a>. (It is currently false in IE, it uses styleFloat instead).<\/li>\n<li><code>hrefNormalized<\/code> is equal to true if the <code>.getAttribute()<\/code> method retrieves the <code>href<\/code> attribute of elements unchanged, rather than normalizing it to a fully-qualified URL. (It is currently false in IE, the URLs are normalized).\n  <div><a href=\"http:\/\/www.w3.org\/TR\/DOM-Level-3-Core\/core.html#ID-666EE0F9\">DOM l3 spec<\/a><\/div><\/li>\n<li><code>htmlSerialize<\/code> is equal to true  if the browser is able to serialize\/insert <code>&lt;link&gt;<\/code> elements using the <code>.innerHTML<\/code> property of elements. (is currently false in IE). <div><a href=\"http:\/\/www.w3.org\/TR\/2008\/WD-html5-20080610\/serializing.html#html-fragment\">HTML5 WD<\/a><\/div><\/li>\n<li><code>leadingWhitespace<\/code> is equal to true if the browser inserts content with .innerHTML exactly as provided\u2014specifically, if leading whitespace characters are preserved. (It is currently false in IE 6-8). <div><a href=\"http:\/\/www.w3.org\/TR\/2008\/WD-html5-20080610\/dom.html#innerhtml0\">HTML5 WD<\/a><\/div><\/li>\n<li><code>noCloneChecked<\/code> is equal to true if cloned DOM elements copy over the state of the <code>.checked<\/code> expando. (It is currently false in IE). (Added in jQuery 1.5.1)<\/li>\n<li><code>noCloneEvent<\/code> is equal to true  if cloned DOM elements are created without event handlers (that is, if the event handlers on the source element are not cloned). (It is currently false in IE). <div><a href=\"http:\/\/www.w3.org\/TR\/DOM-Level-2-Events\/events.html#Events-Registration-interfaces-h3\">DOM l2 spec<\/a><\/div><\/li>\n<li><code>opacity<\/code> is equal to true if a browser can properly interpret the opacity style property. (It is currently false in IE, it uses alpha filters instead). <div><a href=\"http:\/\/www.w3.org\/TR\/css3-color\/#transparency\">CSS3 spec<\/a><\/div><\/li>\n<li><code>optDisabled<\/code> is equal to true if option elements within disabled select elements are not automatically marked as disabled. <div><a href=\"http:\/\/dev.w3.org\/html5\/spec\/the-button-element.html#attr-option-disabled\">HTML5 WD<\/a><\/div><\/li>\n<li><code>optSelected<\/code> is equal to true if an <code>&lt;option&gt;<\/code> element that is selected by default has a working <code>selected<\/code> property. <div><a href=\"http:\/\/dev.w3.org\/html5\/spec\/the-button-element.html#attr-option-selected\">HTML5 WD<\/a><\/div><\/li>\n<li><code>scriptEval()<\/code> is equal to true if inline scripts are automatically evaluated and executed when inserted into the document using standard DOM manipulation methods such as <code>.appendChild()<\/code> and <code>.createTextNode()<\/code>. (It is currently false in IE, it uses <code>.text<\/code> to insert executable scripts). \n<div><strong>Note: No longer supported; removed in jQuery 1.6. Prior to jQuery 1.5.1<\/strong>, the <code>scriptEval()<\/code> method was the static <code>scriptEval<\/code> property. The change to a method allowed the test to be deferred until first use to prevent content security policy inline-script violations. <\/div>\n<div><a href=\"http:\/\/www.w3.org\/TR\/2008\/WD-html5-20080610\/tabular.html#script\">HTML5 WD<\/a><\/div><\/li>\n<li><code>style<\/code> is equal to true if inline styles for an element can be accessed through the DOM attribute called style, as required by the DOM Level 2 specification. In this case, <code>.getAttribute('style')<\/code> can retrieve this value; in Internet Explorer, <code>.cssText<\/code> is used for this purpose. <div><a href=\"http:\/\/www.w3.org\/TR\/DOM-Level-2-Style\/css.html#CSS-ElementCSSInlineStyle\">DOM l2 Style spec<\/a><\/div><\/li>\n<li><code>submitBubbles<\/code> is equal to true if the submit event bubbles up the DOM tree, as required by the <a href=\"http:\/\/www.w3.org\/TR\/DOM-Level-2-Events\/events.html#Events-eventgroupings-htmlevents\">W3C DOM event model<\/a>. (It is currently false in IE, and jQuery simulates bubbling).<\/li>\n<li><code>tbody<\/code> is equal to true if an empty <code>&lt;table&gt;<\/code> element can exist without a <code>&lt;tbody&gt;<\/code> element. According to the HTML specification, this sub-element is optional, so the property should be true in a fully-compliant browser. If false, we must account for the possibility of the browser injecting <code>&lt;tbody&gt;<\/code> tags implicitly. (It is currently false in IE, which automatically inserts <code>tbody<\/code> if it is not present in a string assigned to <code>innerHTML<\/code>). <div><a href=\"http:\/\/dev.w3.org\/html5\/spec\/Overview.html#the-table-element\">HTML5 spec<\/a><\/div><\/li>\n<\/ul>\n","categories":["Properties > Properties of the Global jQuery Object","Utilities","Version > Version 1.3","Version > Version 1.5.1"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.trim\/","name":"jQuery.trim","title":"jQuery.trim()","type":"method","signatures":[{"added":"1.0","params":[{"name":"str","type":"String","optional":"","desc":"The string to trim."}]}],"desc":"Remove the whitespace from the beginning and end of a string.","longdesc":"\n    <p>The <code>$.trim()<\/code> function removes all newlines, spaces (including non-breaking spaces), and tabs from the beginning and end of the supplied string. If these whitespace characters occur in the middle of the string, they are preserved.<\/p>\n  ","categories":["Utilities","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.type\/","name":"jQuery.type","title":"jQuery.type()","type":"method","signatures":[{"added":"1.4.3","params":[{"name":"obj","type":"Object","optional":"","desc":"Object to get the internal JavaScript [[Class]] of."}]}],"desc":"Determine the internal JavaScript [[Class]] of an object.","longdesc":"<p>A number of techniques are used to determine the exact return value for an object. The [[Class]] is determined as follows:<\/p>\n<ul>\n<li>If the object is undefined or null, then \"undefined\" or \"null\" is returned accordingly.\n  <ul>\n    <li>jQuery.type(undefined) === \"undefined\"<\/li>\n    <li>jQuery.type() === \"undefined\"<\/li>\n    <li>jQuery.type(window.notDefined) === \"undefined\"<\/li>\n    <li>jQuery.type(null) === \"null\"<\/li>\n  <\/ul>\n<\/li>\n<li>If the object has an internal [[Class]] equivalent to one of the browser's built-in objects, the associated name is returned. (<a href=\"http:\/\/perfectionkills.com\/instanceof-considered-harmful-or-how-to-write-a-robust-isarray\/\">More details about this technique.<\/a>)<ul>\n<li>jQuery.type(true) === \"boolean\"<\/li>\n<li>jQuery.type(3) === \"number\"<\/li>\n<li>jQuery.type(\"test\") === \"string\"<\/li>\n<li>jQuery.type(function(){}) === \"function\"<\/li>\n<li>jQuery.type([]) === \"array\"<\/li>\n<li>jQuery.type(new Date()) === \"date\"<\/li>\n<li>jQuery.type(\/test\/) === \"regexp\"<\/li>\n<\/ul><\/li>\n<li>Everything else returns \"object\" as its type.<\/li>\n<\/ul>\n","categories":["Utilities","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.unique\/","name":"jQuery.unique","title":"jQuery.unique()","type":"method","signatures":[{"added":"1.1.3","params":[{"name":"array","type":"Array","optional":"","desc":"The Array of DOM elements."}]}],"desc":"Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.","longdesc":"<p>The <code>$.unique()<\/code> function searches through an array of objects, sorting the array, and removing any duplicate nodes. This function only works on plain JavaScript arrays of DOM elements, and is chiefly used internally by jQuery.<\/p>\n<p>As of jQuery 1.4 the results will always be returned in document order.<\/p>","categories":["Utilities","Version > Version 1.1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/jQuery.when\/","name":"jQuery.when","title":"jQuery.when()","type":"method","signatures":[{"added":"1.5","params":[{"name":"deferreds","type":"Deferred","optional":"","desc":"One or more Deferred objects, or plain JavaScript objects."}]}],"desc":"Provides a way to execute callback functions based on one or more objects, usually <a href=\"\/category\/deferred-object\/\">Deferred<\/a> objects that represent asynchronous events.","longdesc":"\n<p>If a single Deferred is passed to <code>jQuery.when<\/code>, its Promise object (a subset of the Deferred methods) is returned by the method. Additional methods of the Promise object can be called to attach callbacks, such as <a href=\"\/deferred.then\"><code>deferred.then<\/code><\/a>. When the Deferred is resolved or rejected, usually by the code that created the Deferred originally, the appropriate callbacks will be called. For example, the jqXHR object returned by <code>jQuery.ajax<\/code> is a Deferred and can be used this way:<\/p><pre>$.when( $.ajax(\"test.aspx\") ).then(function(ajaxArgs){ \n     alert(ajaxArgs[1]); \/* ajaxArgs is [ \"success\", statusText, jqXHR ] *\/\n});<\/pre>\n<p>If a single argument is passed to <code>jQuery.when<\/code> and it is not a Deferred, it will be treated as a resolved Deferred and any doneCallbacks attached will be executed immediately. The doneCallbacks are passed the original argument. In this case any failCallbacks you might set are never called since the Deferred is never rejected. For example:<\/p><pre>$.when( { testing: 123 } ).done(\n   function(x){ alert(x.testing); } \/* alerts \"123\" *\/\n);<\/pre>\n<p>In the case where multiple Deferred objects are passed to <code>jQuery.when<\/code>, the method returns the Promise from a new \"master\" Deferred object that tracks the aggregate state of all the Deferreds it has been passed. The method will resolve its master Deferred as soon as all the Deferreds resolve, or reject the master Deferred as soon as one of the Deferreds is rejected. If the master Deferred is resolved, it is passed the resolved values of all the Deferreds that were passed to <code>jQuery.when<\/code>. For example, when the Deferreds are <code>jQuery.ajax()<\/code> requests, the arguments will be the jqXHR objects for the requests, in the order they were given in the argument list.<\/p>\n<p>In the multiple-Deferreds case where one of the Deferreds is rejected, <code>jQuery.when<\/code> immediately fires the failCallbacks for its master Deferred. Note that some of the Deferreds may still be unresolved at that point. If you need to perform additional processing for this case, such as canceling any unfinished ajax requests, you can keep references to the underlying jqXHR objects in a closure and inspect\/cancel them in the failCallback.<\/p>\n","categories":["Core","Deferred Object","Version > Version 1.5"],"download":""},{"url":"http:\/\/api.jquery.com\/keydown\/","name":"keydown","title":".keydown()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"keydown\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('keydown', handler)<\/code> in the first and second variations, and <code>.trigger('keydown')<\/code> in the third.<\/p>\n<p>The <code>keydown<\/code> event is sent to an element when the user first presses a key on the keyboard. It can be attached to any element, but the event is only sent to the element that has the focus. Focusable elements can vary between browsers, but form elements can always get focus so are reasonable candidates for this event type.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;form&gt;\n  &lt;input id=\"target\" type=\"text\" value=\"Hello there\" \/&gt;\n&lt;\/form&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;<\/pre>\n<p>The event handler can be bound to the input field:<\/p>\n<pre>$('#target').keydown(function() {\n  alert('Handler for .keydown() called.');\n});<\/pre>\n<p>Now when the insertion point is inside the field, pressing a key displays the alert:<\/p>\n<p><span class=\"output\">Handler for .keydown() called.<\/span><\/p>\n<p>To trigger the event manually, apply <code>.keydown()<\/code> without an argument:<\/p>\n<pre>$('#other').click(function() {\n  $('#target').keydown();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also alert the message.<\/p>\n<p>If key presses anywhere need to be caught (for example, to implement global shortcut keys on a page), it is useful to attach this behavior to the <code>document<\/code> object. Because of event bubbling, all key presses will make their way up the DOM to the <code>document<\/code> object unless explicitly stopped.<\/p>\n<p>To determine which key was pressed, examine the <a href=\"http:\/\/api.jquery.com\/category\/events\/event-object\/\">event object<\/a> that is passed to the handler function. While browsers use differing properties to store this information, jQuery normalizes the <code>.which<\/code> property so you can reliably use it to retrieve the key code. This code corresponds to a key on the keyboard, including codes for special keys such as arrows. For catching actual text entry, <code>.keypress()<\/code> may be a better choice.<\/p>\n","categories":["Events > Keyboard Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/keypress\/","name":"keypress","title":".keypress()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"keypress\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p><strong>Note:<\/strong> as the <code>keypress<\/code> event isn't covered by any official specification, the actual behavior encountered when using it may differ across browsers, browser versions, and platforms.<\/p>\n<p>This method is a shortcut for <code>.bind(\"keypress\", handler)<\/code> in the first two variations, and <code>.trigger(\"keypress\")<\/code> in the third.<\/p>\n<p>The <code>keypress<\/code> event is sent to an element when the browser registers keyboard input. This is similar to the <code>keydown<\/code> event, except in the case of key repeats. If the user presses and holds a key, a <code>keydown <\/code>event is triggered once, but separate <code>keypress<\/code> events are triggered for each inserted character. In addition, modifier keys (such as Shift) trigger <code>keydown<\/code> events but not <code>keypress<\/code> events.<\/p>\n<p>A <code>keypress<\/code> event handler can be attached to any element, but the event is only sent to the element that has the focus. Focusable elements can vary between browsers, but form elements can always get focus so are reasonable candidates for this event type.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;form&gt;\n  &lt;fieldset&gt;\n    &lt;input id=\"target\" type=\"text\" value=\"Hello there\" \/&gt;\n  &lt;\/fieldset&gt;\n&lt;\/form&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;<\/pre>\n<p>The event handler can be bound to the input field:<\/p>\n<pre>$(\"#target\").keypress(function() {\n  alert(\"Handler for .keypress() called.\");\n});<\/pre>\n<p>Now when the insertion point is inside the field, pressing a key displays the alert:<\/p>\n<p><span class=\"output\">Handler for .keypress() called.<\/span><\/p>\n<p>The message repeats if the key is held down. To trigger the event manually, apply <code>.keypress()<\/code> without an argument::<\/p>\n<pre>$('#other').click(function() {\n  $(\"#target\").keypress();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also alert the message.<\/p>\n<p>If key presses anywhere need to be caught (for example, to implement global shortcut keys on a page), it is useful to attach this behavior to the <code>document<\/code> object. Because of event bubbling, all key presses will make their way up the DOM to the <code>document<\/code> object unless explicitly stopped.<\/p>\n<p>To determine which character was entered, examine the <code>event<\/code> object that is passed to the handler function. While browsers use differing properties to store this information, jQuery normalizes the <code>.which<\/code> property so you can reliably use it to retrieve the character code.<\/p>\n<p>Note that <code>keydown<\/code> and <code>keyup<\/code> provide a code indicating which key is pressed, while <code>keypress<\/code> indicates which character was entered. For example, a lowercase \"a\" will be reported as 65 by <code>keydown<\/code> and <code>keyup<\/code>, but as 97 by <code>keypress<\/code>. An uppercase \"A\" is reported as 65 by all events. Because of this distinction, when catching special keystrokes such as arrow keys, <code>.keydown()<\/code> or <code>.keyup()<\/code> is a better choice.<\/p>\n","categories":["Events > Keyboard Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/keyup\/","name":"keyup","title":".keyup()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"keyup\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('keyup', handler)<\/code> in the first two variations, and <code>.trigger('keyup')<\/code> in the third.<\/p>\n<p>The <code>keyup<\/code> event is sent to an element when the user releases a key on the keyboard. It can be attached to any element, but the event is only sent to the element that has the focus. Focusable elements can vary between browsers, but form elements can always get focus so are reasonable candidates for this event type.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;form&gt;\n  &lt;input id=\"target\" type=\"text\" value=\"Hello there\" \/&gt;\n&lt;\/form&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;<\/pre>\n<p>The event handler can be bound to the input field:<\/p>\n<pre>$('#target').keyup(function() {\n  alert('Handler for .keyup() called.');\n});\n<\/pre>\n<p>Now when the insertion point is inside the field and a key is pressed and released, the alert is displayed:<\/p>\n<p><span class=\"output\">Handler for .keyup() called.<\/span><\/p>\n<p>To trigger the event manually, apply <code>.keyup()<\/code> without arguments:<\/p>\n<pre>$('#other').click(function() {\n  $('#target').keyup();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also alert the message.<\/p>\n<p>If key presses anywhere need to be caught (for example, to implement global shortcut keys on a page), it is useful to attach this behavior to the <code>document<\/code> object. Because of event bubbling, all key presses will make their way up the DOM to the <code>document<\/code> object unless explicitly stopped.<\/p>\n<p>To determine which key was pressed, examine the event object that is passed to the handler function. While browsers use differing properties to store this information, jQuery normalizes the <code>.which<\/code> property so you can reliably use it to retrieve the key code. This code corresponds to a key on the keyboard, including codes for special keys such as arrows. For catching actual text entry, <code>.keypress()<\/code> may be a better choice.<\/p>\n","categories":["Events > Keyboard Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/last\/","name":"last","title":".last()","type":"method","signatures":[{"added":"1.4"}],"desc":"Reduce the set of matched elements to the final one in the set.","longdesc":"[<p>Given a jQuery object that represents a set of DOM elements, the <code>.last()<\/code> method constructs a new jQuery object from the last matching element.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li&gt;list item 1&lt;\/li&gt;\n  &lt;li&gt;list item 2&lt;\/li&gt;\n  &lt;li&gt;list item 3&lt;\/li&gt;\n  &lt;li&gt;list item 4&lt;\/li&gt;\n  &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>We can apply this method to the set of list items:<\/p>\n<pre>$('li').last().css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background for the final item.<\/p>","categories":["Traversing > Filtering","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/last-child-selector\/","name":"last-child","title":":last-child Selector","type":"selector","signatures":[{"added":"1.1.4"}],"desc":"Selects all elements that are the last child of their parent.","longdesc":"<p>While <a href=\"\/last-selector\">:last<\/a> matches only a single element, <code>:last-child<\/code> can match more than one: one for each parent.<\/p>","categories":["Selectors > Child Filter","Version > Version 1.1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/last-selector\/","name":"last","title":":last Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects the last matched element.","longdesc":"<p>Note that <code>:last<\/code> selects a single element by filtering  the current jQuery collection and matching the last element within it.<\/p>","categories":["Selectors > Basic Filter","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/length\/","name":"length","title":".length","type":"property","signatures":[{"added":"1.0"}],"desc":"The number of elements in the jQuery object.","longdesc":"<p>The number of elements currently matched. The .<a href=\"\/size\">size()<\/a> method will return the same value.<\/p>","categories":["Properties > Properties of jQuery Object Instances","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/live\/","name":"live","title":".live()","type":"method","signatures":[{"added":"1.3","params":[{"name":"events","type":"String","optional":"","desc":"A string containing a JavaScript event type, such as \"click\" or \"keydown.\" As of jQuery 1.4 the string can contain multiple, space-separated event types or custom event names."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute at the time the event is triggered."}]},{"added":"1.4","params":[{"name":"events","type":"String","optional":"","desc":"A string containing a JavaScript event type, such as \"click\" or \"keydown.\" As of jQuery 1.4 the string can contain multiple, space-separated event types or custom event names."},{"name":"data","type":"Object","optional":"","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute at the time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"events-map","type":"Object","optional":"","desc":"A map of one or more JavaScript event types and functions to execute for them."}]}],"desc":"Attach an event handler for all elements which match the current selector, now and in the future.","longdesc":"\n\n<p><strong>As of jQuery 1.7<\/strong>, the <code>.live()<\/code> method is deprecated. Use <a href=\"http:\/\/api.jquery.com\/on\/\"><code>.on()<\/code><\/a> to attach event handlers. Users of older versions of jQuery should use <a href=\"http:\/\/api.jquery.com\/delegate\/\"><code>.delegate()<\/code><\/a> in preference to <code>.live()<\/code>.<\/p>\n\n<p>This method provides a means to attach delegated event handlers to the <code>document<\/code> element of a page, which simplifies the use of event handlers when content is dynamically added to a page. See the discussion of direct versus delegated events in the <a href=\"http:\/\/api.jquery.com\/on\/\"><code>.on()<\/code><\/a> method for more information. <\/p>\n\n<p>Rewriting the <code>.live()<\/code> method in terms of its successors is straightforward; these are templates for equivalent calls for all three event attachment methods:<\/p>\n<pre>\n$(<em>selector<\/em>).live(<em>events<\/em>, <em>data<\/em>, <em>handler<\/em>);                \/\/ jQuery 1.3+\n$(document).delegate(<em>selector<\/em>, <em>events<\/em>, <em>data<\/em>, <em>handler<\/em>);  \/\/ jQuery 1.4.3+\n$(document).on(<em>events<\/em>, <em>selector<\/em>, <em>data<\/em>, <em>handler<\/em>);        \/\/ jQuery 1.7+\n<\/pre>\n\n<p>The <code>events<\/code> argument can either be a space-separated list of event type names and optional namespaces, or an <code>event-map<\/code> of event names strings and handlers. The <code>data<\/code> argument is optional and can be omitted. For example, the following three method calls are functionally equivalent (but see below for more effective and performant ways to attach delegated event handlers):<\/p>\n<pre>\n$(\"a.offsite\").live(\"click\", function(){ alert(\"Goodbye!\"); });                \/\/ jQuery 1.3+\n$(document).delegate(\"a.offsite\", \"click\", function(){ alert(\"Goodbye!\"); });  \/\/ jQuery 1.4.3+\n$(document).on(\"click\", \"a.offsite\", function(){ alert(\"Goodbye!\"); });        \/\/ jQuery 1.7+\n<\/pre>\n\n<p>Use of the <code>.live()<\/code> method is no longer recommended since later versions of jQuery offer better methods that do not have its drawbacks. In particular, the following issues arise with the use of <code>.live()<\/code>:<\/p>\n<ul>\n  <li>jQuery attempts to retrieve the elements specified by the selector before calling the <code>.live()<\/code> method, which may be time-consuming on large documents.<\/li>\n  <li>Chaining methods is not supported. For example, <code>$(\"a\").find(\".offsite, .external\").live( ... ); <\/code> is <em>not<\/em> valid and does not work as expected.<\/li>\n  <li>Since all <code>.live()<\/code> events are attached at the <code>document<\/code> element, events take the longest and slowest possible path before they are handled.<\/li>\n  <li>On mobile iOS (iPhone, iPad and iPod Touch) the <code>click<\/code> event does not bubble to the document body for most elements and cannot be used with <code>.live()<\/code> without applying one of the following workarounds:\n<ol>\n    <li>Use natively clickable elements such as <code>a<\/code> or <code>button<\/code>, as both of these do bubble to <code>document<\/code>.<\/li>\n    <li>Use <code>.on()<\/code> or <code>.delegate()<\/code> attached to an element below the level of <code>document.body<\/code>, since mobile iOS does bubble within the body.<\/li>\n    <li>Apply the CSS style <code>cursor:pointer<\/code> to the element that needs to bubble clicks (or a parent including <code>document.documentElement<\/code>). Note however, this will disable copy\\paste on the element and cause it to be highlighted when touched.<\/li>\n<\/ol>\n<\/li>\n        <li>Calling <a href=\"http:\/\/api.jquery.com\/event.stopPropagation\"><code>event.stopPropagation()<\/code><\/a> in the event handler is ineffective in stopping event handlers attached lower in the document; the event has already propagated to <code>document<\/code>.<\/li>\n        <li>The <code>.live()<\/code> method interacts with other event methods in ways that can be surprising, e.g., <code>$(document).unbind(\"click\")<\/code> removes all click handlers attached by any call to <code>.live()<\/code>!<\/li>\n<\/ul>\n\n<p>For pages still using <code>.live()<\/code>, this list of version-specific differences may be helpful:<\/p>\n<ul>\n        <li>Before jQuery 1.7, to stop further handlers from executing after one bound using <code>.live()<\/code>, the handler must return <code>false<\/code>. Calling <code>.stopPropagation()<\/code> will not accomplish this.<\/li>\n        <li>As of <b>jQuery 1.4<\/b> the <code>.live()<\/code> method supports custom events as well as <em>all JavaScript events that bubble<\/em>. It also supports certain events that don't bubble, including <code>change<\/code>, <code>submit<\/code>, <code>focus<\/code> and <code>blur<\/code>.<\/li>\n        <li>In <b>jQuery 1.3.x<\/b> only the following JavaScript events could be bound: <code>click<\/code>, <code>dblclick<\/code>, <code>keydown<\/code>, <code>keypress<\/code>, <code>keyup<\/code>, <code>mousedown<\/code>, <code>mousemove<\/code>, <code>mouseout<\/code>, <code>mouseover<\/code>, and <code>mouseup<\/code>.<\/li>\n <\/ul>\n","categories":["Deprecated","Events > Event Handler Attachment","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/load\/","name":"load","title":".load()","type":"method","signatures":[{"added":"1.0","params":[{"name":"url","type":"String","optional":"","desc":"A string containing the URL to which the request is sent."},{"name":"data","type":"Map, String","optional":"optional","desc":"A map or string that is sent to the server with the request."},{"name":"complete(responseText, textStatus, XMLHttpRequest)","type":"Function","optional":"optional","desc":"A callback function that is executed when the request completes."}]}],"desc":"Load data from the server and place the returned HTML into the matched element.","longdesc":"\n    <blockquote><p>Note: The event handling suite also has a method named <code><a href=\"\/load-event\">.load()<\/a><\/code>. jQuery determines which method to fire based on the set of arguments passed to it.<\/p><\/blockquote>\n    <p>This method is the simplest way to fetch data from the server. It is roughly equivalent to <code>$.get(url, data, success)<\/code> except that it is a method rather than global function and it has an implicit callback function.  When a successful response is detected (i.e. when <code>textStatus<\/code> is \"success\" or \"notmodified\"), <code>.load()<\/code> sets the HTML contents of the matched element to the returned data. This means that most uses of the method can be quite simple:<\/p>\n    <pre>$('#result').load('ajax\/test.html');<\/pre>\n    <h4 id=\"callback-function\">Callback Function<\/h4>\n    <p>If a \"complete\" callback is provided, it is executed after post-processing and HTML insertion has been performed. The callback is fired once for each element in the jQuery collection, and <code>this<\/code> is set to each DOM element in turn.<\/p>\n    <pre>$('#result').load('ajax\/test.html', function() {\n  alert('Load was performed.');\n});<\/pre>\n    <p>In the two examples above, if the current document does not contain an element with an ID of \"result,\" the <code>.load()<\/code> method is not executed.<\/p>\n    <h4 id=\"request-method\">Request Method<\/h4>\n    <p>The POST method is used if data is provided as an object; otherwise, GET is assumed.<\/p>\n    <h4 id=\"loading-page-fragments\">Loading Page Fragments<\/h4>\n    <p>The <code>.load()<\/code> method, unlike <code><a href=\"\/jQuery.get\">$.get()<\/a><\/code>, allows us to specify a portion of the remote document to be inserted. This is achieved with a special syntax for the <code>url<\/code> parameter. If one or more space characters are included in the string, the portion of the string following the first space is assumed to be a jQuery selector that determines the content to be loaded.   <\/p>\n    <p>We could modify the example above to use only part of the document that is fetched:<\/p>\n    <pre>$('#result').load('ajax\/test.html #container');<\/pre>\n    <p>When this method executes, it retrieves the content of <code>ajax\/test.html<\/code>, but then jQuery parses the returned document to find the element with an ID of <code>container<\/code>. This element, along with its contents, is inserted into the element with an ID of <code>result<\/code>, and the rest of the retrieved document is discarded.<\/p>\n<p>jQuery uses the browser's <code>.innerHTML<\/code> property to parse the retrieved document and insert it into the current document. During this process, browsers often filter elements from the document such as <code>&lt;html&gt;<\/code>, <code>&lt;title&gt;<\/code>, or <code>&lt;head&gt;<\/code> elements. As a result, the elements retrieved by <code>.load()<\/code> may not be exactly the same as if the document were retrieved directly by the browser.<\/p>\n  <h4 id=\"script-execution\">Script Execution<\/h4>\n<p> When calling <code>.load()<\/code> using a URL without a suffixed selector expression, the content is passed to <code>.html()<\/code> prior to scripts being removed. This executes the script blocks before they are discarded. If <code>.load()<\/code> is called with a selector expression appended to the URL, however, the scripts are stripped out prior to the DOM being updated, and thus are <em>not<\/em> executed. An example of both cases can be seen below:\n<\/p>\n<p>Here, any JavaScript loaded into <code>#a<\/code> as a part of the document will successfully execute.<\/p>\n<pre>\n$('#a').load('article.html');\n<\/pre>\n<p>However, in the following case, script blocks in the document being loaded into <code>#b<\/code> are stripped out and not executed:<\/p>\n<pre>\n$('#b').load('article.html #target');\n<\/pre>\n\n  ","categories":["Ajax > Shorthand Methods","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/load-event\/","name":"load","title":".load()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute when the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]}],"desc":"Bind an event handler to the \"load\" JavaScript event.","longdesc":"\n  <p>This method is a shortcut for <code>.bind('load', handler)<\/code>.<\/p>\n  <p>The <code>load<\/code> event is sent to an element when it and all sub-elements have been completely loaded. This event can be sent to any element associated with a URL: images, scripts, frames, iframes, and the <code>window<\/code> object.<\/p>\n<p>For example, consider a page with a simple image:<\/p>\n<pre>&lt;img src=\"book.png\" alt=\"Book\" id=\"book\" \/&gt;<\/pre>\n<p>The event handler can be bound to the image:<\/p>\n<pre>$('#book').load(function() {\n  \/\/ Handler for .load() called.\n});<\/pre>\n<p>As soon as the image has been loaded, the handler is called.<\/p>\n<p>In general, it is not necessary to wait for all images to be fully loaded. If code can be executed earlier, it is usually best to place it in a handler sent to the <code>.ready()<\/code> method.\n<\/p>\n<blockquote><p>The Ajax module also has a method named <code><a href=\"\/load\">.load()<\/a><\/code>. Which one is fired depends on the set of arguments passed.<\/p><\/blockquote>\n<blockquote><p>\n<b>Caveats of the <code>load<\/code> event when used with images<\/b>\n<p>A common challenge developers attempt to solve using the <code>.load()<\/code> shortcut is to execute a function when an image (or collection of images) have completely loaded. There are several known caveats with this that should be noted. These are:<\/p>\n<ul><li>It doesn't work consistently nor reliably cross-browser<\/li>\n<li>It doesn't fire correctly in WebKit if the image src is set to the same src as before<\/li>\n<li>It doesn't correctly bubble up the DOM tree<\/li>\n<li>Can cease to fire for images that already live in the browser's cache<\/li>\n<\/ul><\/p><\/blockquote>\n<blockquote><p><strong>Note:<\/strong> The <code>.live()<\/code> and <code>.delegate()<\/code> methods cannot be used to detect the <code>load<\/code> event of an iframe. The load event does not correctly bubble up the parent document and the event.target isn't set by Firefox, IE9 or Chrome, which is required to do event delegation.<\/p><\/blockquote>\n","categories":["Events > Document Loading","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/lt-selector\/","name":"lt","title":":lt() Selector","type":"selector","signatures":[{"added":"1.0","params":[{"name":"index","type":"Number","optional":"","desc":"Zero-based index."}]}],"desc":"Select all elements at an index less than <code>index<\/code> within the matched set.","longdesc":"<p><strong>index-related selectors<\/strong><\/p>\n      <p>The index-related selectors (including this \"less than\" selector) filter the set of elements that have matched the expressions that precede them. They narrow the set down based on the order of the elements within this matched set. For example, if elements are first selected with a class selector (<code>.myclass<\/code>) and four elements are returned, these elements are given indices 0 through 3 for the purposes of these selectors.<\/p>\n    <p>Note that since JavaScript arrays use <em>0-based indexing<\/em>, these selectors reflect that fact. This is why <code>$('.myclass:lt(1)')<\/code> selects the first element in the document with the class <code>myclass<\/code>, rather than selecting no elements. In contrast, <code>:nth-child(n)<\/code> uses <em>1-based indexing<\/em> to conform to the CSS specification.<\/p>\n    ","categories":["Selectors > Basic Filter","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/map\/","name":"map","title":".map()","type":"method","signatures":[{"added":"1.2","params":[{"name":"callback(index, domElement)","type":"Function","optional":"","desc":"A function object that will be invoked for each element in the current set."}]}],"desc":"Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.","longdesc":"<p>As the return value is a jQuery-wrapped array, it's very common to <code>get()<\/code> the returned object to work with a basic array.<\/p><p>The <code>.map()<\/code> method is particularly useful for getting or setting the value of a collection of elements. Consider a form with a set of checkboxes in it:<\/p>\n<pre>\n&lt;form method=\"post\" action=\"\"&gt;\n  &lt;fieldset&gt;\n    &lt;div&gt;\n      &lt;label for=\"two\"&gt;2&lt;\/label&gt;\n      &lt;input type=\"checkbox\" value=\"2\" id=\"two\" name=\"number[]\"&gt;\n    &lt;\/div&gt;\n    &lt;div&gt;\n      &lt;label for=\"four\"&gt;4&lt;\/label&gt;\n      &lt;input type=\"checkbox\" value=\"4\" id=\"four\" name=\"number[]\"&gt;\n    &lt;\/div&gt;\n    &lt;div&gt;\n      &lt;label for=\"six\"&gt;6&lt;\/label&gt;\n      &lt;input type=\"checkbox\" value=\"6\" id=\"six\" name=\"number[]\"&gt;\n    &lt;\/div&gt;\n    &lt;div&gt;\n      &lt;label for=\"eight\"&gt;8&lt;\/label&gt;\n      &lt;input type=\"checkbox\" value=\"8\" id=\"eight\" name=\"number[]\"&gt;\n    &lt;\/div&gt;\n  &lt;\/fieldset&gt;\n&lt;\/form&gt;\n<\/pre>\n<p>We can get a comma-separated list of checkbox <code>ID<\/code>s:<\/p>\n<pre>$(':checkbox').map(function() {\n  return this.id;\n}).get().join(',');<\/pre>\n<p>The result of this call is the string, <code>\"two,four,six,eight\"<\/code>.<\/p>\n<p>Within the callback function, <code>this<\/code> refers to the current DOM element for each iteration. The function can return an individual data item or an array of data items to be inserted into the resulting set. If an array is returned, the elements inside the array are inserted into the set. If the function returns <code>null<\/code> or <code>undefined<\/code>, no element will be inserted.<\/p>\n","categories":["Traversing > Filtering","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/mousedown\/","name":"mousedown","title":".mousedown()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"mousedown\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('mousedown', handler)<\/code> in the first variation, and <code>.trigger('mousedown')<\/code> in the second.<\/p>\n<p>The <code>mousedown<\/code> event is sent to an element when the mouse pointer is over the element, and the mouse button is pressed. Any HTML element can receive this event.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;div id=\"target\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;<\/pre>\n \n<p class=\"image\"><img src=\"\/images\/0042_05_01.png\" alt=\"\"\/><\/p>\n<p>The event handler can be bound to any <code>&lt;div&gt;<\/code>:<\/p>\n<pre>$('#target').mousedown(function() {\n  alert('Handler for .mousedown() called.');\n});<\/pre>\n<p>Now if we click on this element, the alert is displayed:<\/p>\n<p><span class=\"output\">Handler for .mousedown() called.<\/span><\/p>\n<p>We can also trigger the event when a different element is clicked:<\/p>\n<pre>$('#other').click(function() {\n  $('#target').mousedown();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also alert the message.<\/p>\n<p>The <code>mousedown<\/code> event is sent when any mouse button is clicked. To act only on specific buttons, we can use the event object's <code>which <\/code>property. Not all browsers support this property (Internet Explorer uses button instead), but jQuery normalizes the property so that it is safe to use in any browser. The value of <code>which<\/code> will be 1 for the left button, 2 for the middle button, or 3 for the right button.<\/p>\n<p>This event is primarily useful for ensuring that the primary button was used to begin a drag operation; if ignored, strange results can occur when the user attempts to use a context menu. While the middle and right buttons can be detected with these properties, this is not reliable. In Opera and Safari, for example, right mouse button clicks are not detectable by default.<\/p>\n<p>If the user clicks on an element, drags away from it, and releases the button, this is still counted as a <code>mousedown<\/code> event. This sequence of actions is treated as a \"canceling\" of the button press in most user interfaces, so it is usually better to use the <code>click<\/code> event unless we know that the <code>mousedown<\/code> event is preferable for a particular situation.<\/p>\n\n","categories":["Events > Mouse Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/mouseenter\/","name":"mouseenter","title":".mouseenter()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('mouseenter', handler)<\/code> in the first two variations, and <code>.trigger('mouseenter')<\/code> in the third.<\/p>\n<p>The <code>mouseenter<\/code> JavaScript event is proprietary to Internet Explorer. Because of the event's general utility, jQuery simulates this event so that it can be used regardless of browser. This event is sent to an element when the mouse pointer enters the element. Any HTML element can receive this event.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;div id=\"outer\"&gt;\n  Outer\n  &lt;div id=\"inner\"&gt;\n    Inner\n  &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;\n&lt;div id=\"log\"&gt;&lt;\/div&gt;<\/pre>\n \n<p class=\"image\"><img src=\"\/images\/0042_05_08.png\" alt=\"\"\/>\n<\/p>\n<p>The event handler can be bound to any element:<\/p>\n<pre>$('#outer').mouseenter(function() {\n  $('#log').append('&lt;div&gt;Handler for .mouseenter() called.&lt;\/div&gt;');\n});<\/pre>\n<p>Now when the mouse pointer moves over the <span class=\"output\">Outer<\/span> <code>&lt;div&gt;<\/code>, the message is appended to <code>&lt;div id=\"log\"&gt;<\/code>. You can also trigger the event when another element is clicked:<\/p>\n<pre>$('#other').click(function() {\n  $('#outer').mouseenter();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also append the message.<\/p>\n<p>The <code>mouseenter<\/code> event differs from <code>mouseover<\/code> in the way it handles event bubbling. If <code>mouseover<\/code> were used in this example, then when the mouse pointer moved over the <span class=\"output\">Inner<\/span> element, the handler would be triggered. This is usually undesirable behavior. The <code>mouseenter<\/code> event, on the other hand, only triggers its handler when the mouse enters the element it is bound to, not a descendant. So in this example, the handler is triggered when the mouse enters the <span class=\"output\">Outer<\/span> element, but not the <span class=\"output\">Inner<\/span> element.<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/mouseleave\/","name":"mouseleave","title":".mouseleave()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('mouseleave', handler)<\/code> in the first two variations, and <code>.trigger('mouseleave')<\/code> in the third.<\/p>\n<p>The <code>mouseleave<\/code> JavaScript event is proprietary to Internet Explorer. Because of the event's general utility, jQuery simulates this event so that it can be used regardless of browser. This event is sent to an element when the mouse pointer leaves the element. Any HTML element can receive this event.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;div id=\"outer\"&gt;\n  Outer\n  &lt;div id=\"inner\"&gt;\n    Inner\n  &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;\n&lt;div id=\"log\"&gt;&lt;\/div&gt;<\/pre> \n<p class=\"image\"><img src=\"\/images\/0042_05_09.png\" alt=\"\"\/>\n<\/p>\n<p>The event handler can be bound to any element:<\/p>\n<pre>$('#outer').mouseleave(function() {\n  $('#log').append('&lt;div&gt;Handler for .mouseleave() called.&lt;\/div&gt;');\n});<\/pre>\n<p>Now when the mouse pointer moves out of the <span class=\"output\">Outer<\/span> <code>&lt;div&gt;<\/code>, the message is appended to <code>&lt;div id=\"log\"&gt;<\/code>. You can also trigger the event when another element is clicked:<\/p>\n<pre>$('#other').click(function() {\n  $('#outer').mouseleave();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also append the message.<\/p>\n<p>The <code>mouseleave<\/code> event differs from <code>mouseout<\/code> in the way it handles event bubbling. If <code>mouseout<\/code> were used in this example, then when the mouse pointer moved out of the <span class=\"output\">Inner<\/span> element, the handler would be triggered. This is usually undesirable behavior. The <code>mouseleave<\/code> event, on the other hand, only triggers its handler when the mouse leaves the element it is bound to, not a descendant. So in this example, the handler is triggered when the mouse leaves the <span class=\"output\">Outer<\/span> element, but not the <span class=\"output\">Inner<\/span> element.<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/mousemove\/","name":"mousemove","title":".mousemove()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"mousemove\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('mousemove', handler)<\/code> in the first two variations, and <code>.trigger('mousemove')<\/code> in the third.<\/p>\n<p>The <code>mousemove<\/code> event is sent to an element when the mouse pointer moves inside the element. Any HTML element can receive this event.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;div id=\"target\"&gt;\n  Move here\n&lt;\/div&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;\n&lt;div id=\"log\"&gt;&lt;\/div&gt;<\/pre>\n \n<p>The event handler can be bound to the target:<\/p>\n<pre>$(\"#target\").mousemove(function(event) {\n  var msg = \"Handler for .mousemove() called at \";\n  msg += event.pageX + \", \" + event.pageY;\n  $(\"#log\").append(\"&lt;div&gt;\" + msg + \"&lt;\/div&gt;\");\n});<\/pre>\n<p>Now when the mouse pointer moves within the target button, the messages are appended to &lt;div id=\"log\"&gt;:<\/p>\n<p>\n<span class=\"output\">Handler for .mousemove() called at (399, 48)<\/span><br\/>\n<span class=\"output\">Handler for .mousemove() called at (398, 46)<\/span><br\/>\n<span class=\"output\">Handler for .mousemove() called at (397, 44)<\/span><br\/>\n<span class=\"output\">Handler for .mousemove() called at (396, 42)<\/span><br\/>\n<\/p>\n<p>To trigger the event manually, apply <code>.mousemove()<\/code> without an argument:<\/p>\n<pre>$(\"#other\").click(function() {\n  $(\"#target\").mousemove();\n});<\/pre>\n<p>After this code executes, clicks on the Trigger button will also append the message:<\/p>\n<p><span class=\"output\">Handler for .mousemove() called at (undefined, undefined)<\/span><\/p>\n<p>When tracking mouse movement, you usually need to know the actual position of the mouse pointer. The event object that is passed to the handler contains some information about the mouse coordinates. Properties such as <code>.clientX<\/code>, <code>.offsetX<\/code>, and <code>.pageX<\/code> are available, but support for them differs between browsers. Fortunately, jQuery normalizes the <code>.pageX<\/code> and <code>.pageY<\/code> properties so that they can be used in all browsers. These properties provide the X and Y coordinates of the mouse pointer relative to the top-left corner of the document, as illustrated in the example output above.<\/p>\n<p>Keep in mind that the <code>mousemove<\/code> event is triggered whenever the mouse pointer moves, even for a pixel. This means that hundreds of events can be generated over a very small amount of time. If the handler has to do any significant processing, or if multiple handlers for the event exist, this can be a serious performance drain on the browser. It is important, therefore, to optimize <code>mousemove <\/code>handlers as much as possible, and to unbind them as soon as they are no longer needed.<\/p>\n<p>A common pattern is to bind the <code>mousemove<\/code> handler from within a <code>mousedown<\/code> hander, and to unbind it from a corresponding <code>mouseup<\/code> handler. If implementing this sequence of events, remember that the <code>mouseup<\/code> event might be sent to a different HTML element than the <code>mousemove<\/code> event was. To account for this, the <code>mouseup<\/code> handler should typically be bound to an element high up in the DOM tree, such as <code>&lt;body&gt;<\/code>.<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/mouseout\/","name":"mouseout","title":".mouseout()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"mouseout\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('mouseout', handler)<\/code> in the first two variation, and <code>.trigger('mouseout')<\/code> in the third.<\/p>\n<p>The <code>mouseout<\/code> event is sent to an element when the mouse pointer leaves the element. Any HTML element can receive this event.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;div id=\"outer\"&gt;\n  Outer\n  &lt;div id=\"inner\"&gt;\n    Inner\n  &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;\n&lt;div id=\"log\"&gt;&lt;\/div&gt;<\/pre> \n<p class=\"image\"><img src=\"\/images\/0042_05_07.png\" alt=\"\"\/>\n<\/p>\n<p>The event handler can be bound to any element:<\/p>\n<pre>$('#outer').mouseout(function() {\n  $('#log').append('Handler for .mouseout() called.');\n});<\/pre>\n<p>Now when the mouse pointer moves out of the <span class=\"output\">Outer<\/span> <code>&lt;div&gt;<\/code>, the message is appended to <code>&lt;div id=\"log\"&gt;<\/code>. To trigger the event manually, apply <code>.mouseout()<\/code> without an argument::<\/p>\n<pre>$('#other').click(function() {\n  $('#outer').mouseout();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also append the message.<\/p>\n<p>This event type can cause many headaches due to event bubbling. For instance, when the mouse pointer moves out of the <span class=\"output\">Inner<\/span> element in this example, a <code>mouseout<\/code> event will be sent to that, then trickle up to <span class=\"output\">Outer<\/span>. This can trigger the bound <code>mouseout<\/code> handler at inopportune times. See the discussion for <code>.<a href=\"\/mouseleave\">mouseleave<\/a>()<\/code> for a useful alternative.<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/mouseover\/","name":"mouseover","title":".mouseover()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"mouseover\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('mouseover', handler)<\/code> in the first two variations, and <code>.trigger('mouseover')<\/code> in the third.<\/p>\n<p>The <code>mouseover<\/code> event is sent to an element when the mouse pointer enters the element. Any HTML element can receive this event.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;div id=\"outer\"&gt;\n  Outer\n  &lt;div id=\"inner\"&gt;\n    Inner\n  &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;\n&lt;div id=\"log\"&gt;&lt;\/div&gt;<\/pre>\n \n<p class=\"image\"><img src=\"\/images\/0042_05_06.png\" alt=\"\"\/>\n<\/p>\n<p>The event handler can be bound to any element:<\/p>\n<pre>$('#outer').mouseover(function() {\n  $('#log').append('&lt;div&gt;Handler for .mouseover() called.&lt;\/div&gt;');\n});<\/pre>\n<p>Now when the mouse pointer moves over the <span class=\"output\">Outer<\/span> <code>&lt;div&gt;<\/code>, the message is appended to <code>&lt;div id=\"log\"&gt;<\/code>. We can also trigger the event when another element is clicked:<\/p>\n<pre>$('#other').click(function() {\n  $('#outer').mouseover();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also append the message.<\/p>\n<p>This event type can cause many headaches due to event bubbling. For instance, when the mouse pointer moves over the <span class=\"output\">Inner<\/span> element in this example, a <code>mouseover<\/code> event will be sent to that, then trickle up to <span class=\"output\">Outer<\/span>. This can trigger our bound <code>mouseover<\/code> handler at inopportune times. See the discussion for <code>.mouseenter()<\/code> for a useful alternative.<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/mouseup\/","name":"mouseup","title":".mouseup()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"mouseup\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('mouseup', handler)<\/code> in the first variation, and <code>.trigger('mouseup')<\/code> in the second.<\/p>\n<p>The <code>mouseup<\/code> event is sent to an element when the mouse pointer is over the element, and the mouse button is released. Any HTML element can receive this event.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;div id=\"target\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;\n<\/pre> \n<p class=\"image\"><img src=\"\/images\/0042_05_02.png\" alt=\"\"\/><\/p>\n<p>The event handler can be bound to any <code>&lt;div&gt;<\/code>:<\/p>\n<pre>$('#target').mouseup(function() {\n  alert('Handler for .mouseup() called.');\n});\n<\/pre>\n<p>Now if we click on this element, the alert is displayed:<\/p>\n<p><span class=\"output\">Handler for .mouseup() called.<\/span><\/p>\n<p>We can also trigger the event when a different element is clicked:<\/p>\n<pre>$('#other').click(function() {\n  $('#target').mouseup();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also alert the message.<\/p>\n<p>If the user clicks outside an element, drags onto it, and releases the button, this is still counted as a <code>mouseup<\/code> event. This sequence of actions is not treated as a button press in most user interfaces, so it is usually better to use the <code>click<\/code> event unless we know that the <code>mouseup<\/code> event is preferable for a particular situation.<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/multiple-attribute-selector\/","name":"attributeMultiple","title":"Multiple Attribute Selector [name=\"value\"][name2=\"value2\"]","type":"selector","signatures":[{"added":"1.0","params":[{"name":"attributeFilter1","type":"Selector","optional":"","desc":"An attribute filter."},{"name":"attributeFilter2","type":"Selector","optional":"","desc":"Another attribute filter, reducing the selection even more"},{"name":"attributeFilterN","type":"Selector","optional":"optional","desc":"As many more attribute filters as necessary"}]}],"desc":"Matches elements that match all of the specified attribute filters.","longdesc":"<longdesc\/>","categories":["Selectors > Attribute","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/multiple-selector\/","name":"multiple","title":"Multiple Selector (\"selector1, selector2, selectorN\")","type":"selector","signatures":[{"added":"1.0","params":[{"name":"selector1","type":"Selector","optional":"","desc":"Any valid selector."},{"name":"selector2","type":"Selector","optional":"","desc":"Another valid selector."},{"name":"selectorN","type":"Selector","optional":"optional","desc":"As many more valid selectors as you like."}]}],"desc":"Selects the combined results of all the specified selectors.","longdesc":"<p>You can specify any number of selectors to combine into a single result.  This multiple expression combinator is an efficient way to select disparate elements. The order of the DOM elements in the returned jQuery object may not be identical, as they will be in document order. An alternative to this combinator is the .<a href=\"\/add\">add()<\/a> method.<\/p>","categories":["Selectors > Basic","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/next\/","name":"next","title":".next()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.next()<\/code> method allows us to search through the immediately following sibling of these elements in the DOM tree and construct a new jQuery object from the matching elements.<\/p>\n<p>The method optionally accepts a selector expression of the same type that we can pass to the <code>$()<\/code> function. If the immediately following sibling matches the selector, it remains in the newly constructed jQuery object; otherwise, it is excluded.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n&lt;ul&gt;\n   &lt;li&gt;list item 1&lt;\/li&gt;\n   &lt;li&gt;list item 2&lt;\/li&gt;\n   &lt;li class=\"third-item\"&gt;list item 3&lt;\/li&gt;\n   &lt;li&gt;list item 4&lt;\/li&gt;\n   &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>If we begin at the third item, we can find the element which comes just after it:<\/p>\n<pre>$('li.third-item').next().css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background behind item 4. Since we do not supply a selector expression, this following element is unequivocally included as part of the object. If we had supplied one, the element would be tested for a match before it was included.<\/p>","categories":["Traversing > Tree Traversal","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/next-adjacent-Selector\/","name":"next adjacent","title":"Next Adjacent Selector (\"prev + next\")","type":"selector","signatures":[{"added":"1.0","params":[{"name":"prev","type":"Selector","optional":"","desc":"Any valid selector."},{"name":"next","type":"Selector","optional":"","desc":"A selector to match the element that is next to the first selector."}]}],"desc":"Selects all next elements matching \"next\" that are immediately preceded by a sibling \"prev\".","longdesc":"\n<p>One important point to consider with both the next adjacent sibling selector (<code>prev + next<\/code>) and the general sibling selector (<code>prev ~ siblings<\/code>) is that the elements on either side of the combinator must share the same parent.<\/p>","categories":["Selectors > Hierarchy","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/next-siblings-selector\/","name":"next siblings","title":"Next Siblings Selector (\"prev ~ siblings\")","type":"selector","signatures":[{"added":"1.0","params":[{"name":"prev","type":"Selector","optional":"","desc":"Any valid selector."},{"name":"siblings","type":"Selector","optional":"","desc":"A selector to filter elements that are the following siblings of the first selector."}]}],"desc":"Selects all sibling elements that follow after the \"prev\" element, have the same parent, and match the filtering \"siblings\" selector.","longdesc":"<p>The notable difference between (<code>prev + next<\/code>) and (<code>prev ~ siblings<\/code>) is their respective reach. While the former reaches only to the immediately following sibling element, the latter extends that reach to all following sibling elements.<\/p>","categories":["Selectors > Hierarchy","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/nextAll\/","name":"nextAll","title":".nextAll()","type":"method","signatures":[{"added":"1.2","params":[{"name":"selector","type":"String","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.nextAll()<\/code> method allows us to search through the successors of these elements in the DOM tree and construct a new jQuery object from the matching elements.<\/p>\n<p>The method optionally accepts a selector expression of the same type that we can pass to the <code>$()<\/code> function. If the selector is supplied, the elements will be filtered by testing whether they match it.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n&lt;ul&gt;\n   &lt;li&gt;list item 1&lt;\/li&gt;\n   &lt;li&gt;list item 2&lt;\/li&gt;\n   &lt;li class=\"third-item\"&gt;list item 3&lt;\/li&gt;\n   &lt;li&gt;list item 4&lt;\/li&gt;\n   &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>If we begin at the third item, we can find the elements which come after it:<\/p>\n<pre>$('li.third-item').nextAll().css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background behind items 4 and 5. Since we do not supply a selector expression, these following elements are unequivocally included as part of the object. If we had supplied one, the elements would be tested for a match before they were included.<\/p>","categories":["Traversing > Tree Traversal","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/nextUntil\/","name":"nextUntil","title":".nextUntil()","type":"method","signatures":[{"added":"1.4","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A string containing a selector expression to indicate where to stop matching following sibling elements."},{"name":"filter","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]},{"added":"1.6","params":[{"name":"element","type":"Element","optional":"optional","desc":"A DOM node or jQuery object indicating where to stop matching following sibling elements."},{"name":"filter","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.","longdesc":"<p>Given a selector expression that represents a set of DOM elements, the <code>.nextUntil()<\/code> method searches through the successors of these elements in the DOM tree, stopping when it reaches an element matched by the method's argument. The new jQuery object that is returned contains all following siblings up to but not including the one matched by the <code>.nextUntil()<\/code> argument.<\/p>\n  <p>If the selector is not matched or is not supplied, all following siblings will be selected; in these cases it selects the same elements as the <code>.nextAll()<\/code> method does when no filter selector is provided.<\/p>\n  <p><strong>As of jQuery 1.6<\/strong>, A DOM node or jQuery object, instead of a selector, may be passed to the <code>.nextUntil()<\/code> method.<\/p>\n  <p>The method optionally accepts a selector expression for its second argument. If this argument is supplied, the elements will be filtered by testing whether they match it.<\/p>\n\n","categories":["Traversing > Tree Traversal","Version > Version 1.4","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/not\/","name":"not","title":".not()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"","desc":"A string containing a selector expression to match elements against."}]},{"added":"1.0","params":[{"name":"elements","type":"Elements","optional":"","desc":"One or more DOM elements to remove from the matched set."}]},{"added":"1.4","params":[{"name":"function(index)","type":"Function","optional":"","desc":"A function used as a test for each element in the set. <code>this<\/code> is the current DOM element."}]},{"added":"1.4","params":[{"name":"jQuery object","type":"Object","optional":"","desc":"An existing jQuery object to match the current set of elements against."}]}],"desc":"Remove elements from the set of matched elements.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.not()<\/code> method constructs a new jQuery object from a subset of the matching elements. The supplied selector is tested against each element; the elements that don't match the selector will be included in the result.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li&gt;list item 1&lt;\/li&gt;\n  &lt;li&gt;list item 2&lt;\/li&gt;\n  &lt;li&gt;list item 3&lt;\/li&gt;\n  &lt;li&gt;list item 4&lt;\/li&gt;\n  &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>We can apply this method to the set of list items:<\/p>\n<pre>$('li').not(':even').css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background for items 2 and 4, as they do not match the selector (recall that :even and :odd use 0-based indexing).<\/p>\n<h4>Removing Specific Elements<\/h4>\n<p>The second version of the <code>.not()<\/code> method allows us to remove elements from the matched set, assuming we have found those elements previously by some other means. For example, suppose our list had an id applied to one of its items:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li&gt;list item 1&lt;\/li&gt;\n  &lt;li&gt;list item 2&lt;\/li&gt;\n  &lt;li id=\"notli\"&gt;list item 3&lt;\/li&gt;\n  &lt;li&gt;list item 4&lt;\/li&gt;\n  &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>We can fetch the third list item using the native JavaScript <code>getElementById()<\/code> function, then remove it from a jQuery object:<\/p>\n<pre>\n$('li').not(document.getElementById('notli'))\n  .css('background-color', 'red');\n<\/pre>\n<p>This statement changes the color of items 1, 2, 4, and 5. We could have accomplished the same thing with a simpler jQuery expression, but this technique can be useful when, for example, other libraries provide references to plain DOM nodes.<\/p>\n<p>As of jQuery 1.4, the <code>.not()<\/code> method can take a function as its argument in the same way that <code>.filter()<\/code> does. Elements for which the function returns <code>true<\/code> are excluded from the filtered set; all other elements are included.<\/p>","categories":["Traversing > Filtering","Traversing > Miscellaneous Traversing","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/not-selector\/","name":"not","title":":not() Selector","type":"selector","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"","desc":"A selector with which to filter by."}]}],"desc":"Selects all elements that do not match the given selector.","longdesc":"<p>All selectors are accepted inside <code>:not()<\/code>,  for example: <code>:not(div a)<\/code> and <code>:not(div,a)<\/code>.<\/p> <h3>Additional Notes<\/h3><p>The <code><a href=\"\/not\/\">.not()<\/a><\/code> method will end up providing you with more readable selections than pushing complex selectors or variables into a <code>:not()<\/code> selector filter. In most cases, it is a better choice.<\/p>","categories":["Selectors > Basic Filter","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/nth-child-selector\/","name":"nth-child","title":":nth-child() Selector","type":"selector","signatures":[{"added":"1.1.4","params":[{"name":"index","type":"Number\/String","optional":"","desc":"The index of each child to match, starting with <code>1<\/code>, the string <code>even<\/code> or <code>odd<\/code>, or an equation ( eg. <code>:nth-child(even)<\/code>, <code>:nth-child(4n)<\/code> )"}]}],"desc":"Selects all elements that are the nth-child of their parent.","longdesc":"<p>Because jQuery's implementation of <code>:nth-child(n)<\/code> is strictly derived from the CSS specification, the value of <code>n<\/code> is \"1-indexed\", meaning that the counting starts at 1. For all other selector expressions, however, jQuery follows JavaScript's \"0-indexed\" counting. Therefore, given a single <code>&lt;ul&gt;<\/code> containing two <code>&lt;li&gt;<\/code>s, <code>$('li:nth-child(1)')<\/code> selects the first <code>&lt;li&gt;<\/code> while  <code>$('li:eq(1)')<\/code> selects the second.<\/p>\n                \n<p>The <code>:nth-child(n)<\/code> pseudo-class is easily confused with <code>:eq(n)<\/code>, even though the two can result in dramatically different matched elements. With <code>:nth-child(n)<\/code>, all children are counted, regardless of what they are, and the specified element is selected only if it matches the selector attached to the pseudo-class. With <code>:eq(n)<\/code> only the selector attached to the pseudo-class is counted, not limited to children of any other element, and the (n+1)th one (n is 0-based) is selected.<\/p> \n\n<p>Further discussion of this unusual usage can be found in the <a href=\"http:\/\/www.w3.org\/TR\/css3-selectors\/#nth-child-pseudo\">W3C CSS specification<\/a>.<\/p>\n                    ","categories":["Selectors > Child Filter","Version > Version 1.1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/odd-selector\/","name":"odd","title":":odd Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects odd elements, zero-indexed.  See also <a href=\"\/Selectors\/even\">even<\/a>.","longdesc":"<p>In particular, note that the <em>0-based indexing<\/em> means that, counter-intuitively, <code>:odd<\/code> selects the second element, fourth element, and so on within the matched set.<\/p>","categories":["Selectors > Basic Filter","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/off\/","name":"off","title":".off()","type":"method","signatures":[{"added":"1.7","params":[{"name":"events","type":"String","optional":"","desc":"One or more space-separated event types and optional namespaces, or just namespaces, such as \"click\", \"keydown.myPlugin\", or \".myPlugin\"."},{"name":"selector","type":"String","optional":"optional","desc":"A selector which should match the one originally passed to <code>.on()<\/code> when attaching event handlers."},{"name":"handler(eventObject)","type":"Function","optional":"optional","desc":"A handler function previously attached for the event(s), or the special value <code>false<\/code>."}]},{"added":"1.7","params":[{"name":"events-map","type":"Map","optional":"","desc":"A map where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s)."},{"name":"selector","type":"String","optional":"optional","desc":"A selector which should match the one originally passed to <code>.on()<\/code> when attaching event handlers."}]}],"desc":"Remove an event handler.","longdesc":"\n  <p>The <code>off()<\/code> method removes event handlers that were attached with <a href=\"http:\/\/api.jquery.com\/on\"><code>.on()<\/code><\/a>. See the discussion of delegated and directly bound events on that page for more information. Specific event handlers can be removed on elements by providing combinations of event names, namespaces, selectors, or handler function names. <strong>When multiple filtering arguments are given, all of the arguments provided must match for the event handler to be removed.<\/strong><\/p>\n  \n  <p>If a simple event name such as <code>\"click\"<\/code> is provided, <em>all<\/em> events of that type (both direct and delegated) are removed from the elements in the jQuery set. When writing code that will be used as a plugin, or simply when working with a large code base, best practice is to attach and remove events using namespaces so that the code will not inadvertently remove event handlers attached by other code. All events of all types in a specific namespace can be removed from an element by providing just a namespace, such as <code>\".myPlugin\"<\/code>. At minimum, either a namespace or event name must be provided.<\/p>\n  \n  <p>To remove specific delegated event handlers, provide a <code>selector<\/code> argument. The selector string must exactly match the one passed to <code>.on()<\/code> when the event handler was attached. To remove all delegated events from an element without removing non-delegated events, use the special value <code>\"**\"<\/code>.<\/p>\n\n  <p>A handler can also be removed by specifying the function name in the <code>handler<\/code> argument. When jQuery attaches an event handler, it assigns a unique id to the handler function. Handlers proxied by <a href=\"http:\/\/api.jquery.com\/jQuery.proxy\"><code>jQuery.proxy()<\/code><\/a> or a similar mechanism will all have the same unique id (the proxy function), so passing proxied handlers to <code>.off<\/code> may remove more handlers than intended. In those situations it is better to attach and remove event handlers using namespaces.<\/p>\n  \n  <p>As with <code>.on()<\/code>, you can pass an <code>events-map<\/code> argument instead of specifying the <code>events<\/code> and <code>handler<\/code> as separate arguments. The keys are events and\/or namespaces; the values are handler functions or the special value <code>false<\/code>.<\/p>\n\n","categories":["Events > Event Handler Attachment","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/offset\/","name":"offset","title":".offset()","type":"method","signatures":[{"added":"1.2"}],"desc":"Get the current coordinates of the first element in the set of matched elements, relative to the document.","longdesc":"<p>The <code>.offset()<\/code> method allows us to retrieve the current position of an element <em>relative to the document<\/em>. Contrast this with <code>.position()<\/code>, which retrieves the current position <em>relative to the offset parent<\/em>. When positioning a new element on top of an existing one for global manipulation (in particular, for implementing drag-and-drop), <code>.offset()<\/code> is the more useful.<\/p>\n\n    <p><code>.offset()<\/code> returns an object containing the properties <code>top<\/code> and <code>left<\/code>.<\/p>\n<blockquote><p><strong>Note:<\/strong> jQuery does not support getting the offset coordinates of hidden elements or accounting for borders, margins, or padding set on the body element.<\/p>\n<p>While it is possible to get the coordinates of elements with <code>visibility:hidden<\/code> set, <code>display:none<\/code> is excluded from the rendering tree and thus has a position that is undefined.<\/p><\/blockquote>    \n    ","categories":["CSS","Offset","Manipulation > Style Properties","Version > Version 1.2","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/offset\/","name":"offset","title":".offset()","type":"method","signatures":[{"added":"1.4","params":[{"name":"coordinates","type":"Object","optional":"","desc":"An object containing the properties <code>top<\/code> and <code>left<\/code>, which are integers indicating the new top and left coordinates for the elements."}]},{"added":"1.4","params":[{"name":"function(index, coords)","type":"Function","optional":"","desc":"A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new <code>top<\/code> and <code>left<\/code> properties."}]}],"desc":"Set the current coordinates of every element in the set of matched elements, relative to the document.","longdesc":"<p>The <code>.offset()<\/code> setter method allows us to reposition an element. The element's position is specified <em>relative to the document<\/em>. If the element's <code>position<\/code> style property is currently <code>static<\/code>, it will be set to <code>relative<\/code> to allow for this repositioning.<\/p>","categories":["CSS","Offset","Manipulation > Style Properties","Version > Version 1.2","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/offsetParent\/","name":"offsetParent","title":".offsetParent()","type":"method","signatures":[{"added":"1.2.6"}],"desc":"Get the closest ancestor element that is positioned.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.offsetParent()<\/code> method allows us to search through the ancestors of these elements in the DOM tree and construct a new jQuery object wrapped around the closest positioned ancestor. An element is said to be positioned if it has a CSS position attribute of <code>relative<\/code>, <code>absolute<\/code>, or <code>fixed<\/code>. This information is useful for calculating offsets for performing animations and placing objects on the page.<\/p>\n<p>Consider a page with a basic nested list on it, with a positioned element:<\/p>\n<pre>\n&lt;ul class=\"level-1\"&gt;\n  &lt;li class=\"item-i\"&gt;I&lt;\/li&gt;\n  &lt;li class=\"item-ii\" style=\"position: relative;\"&gt;II\n    &lt;ul class=\"level-2\"&gt;\n      &lt;li class=\"item-a\"&gt;A&lt;\/li&gt;\n      &lt;li class=\"item-b\"&gt;B\n        &lt;ul class=\"level-3\"&gt;\n          &lt;li class=\"item-1\"&gt;1&lt;\/li&gt;\n          &lt;li class=\"item-2\"&gt;2&lt;\/li&gt;\n          &lt;li class=\"item-3\"&gt;3&lt;\/li&gt;\n        &lt;\/ul&gt;\n      &lt;\/li&gt;\n      &lt;li class=\"item-c\"&gt;C&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/li&gt;\n  &lt;li class=\"item-iii\"&gt;III&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>If we begin at item A, we can find its positioned ancestor:<\/p>\n<pre>$('li.item-a').offsetParent().css('background-color', 'red');<\/pre>\n<p>This will change the color of list item II, which is positioned.<\/p>\n","categories":["Offset","Traversing > Tree Traversal"],"download":""},{"url":"http:\/\/api.jquery.com\/on\/","name":"on","title":".on()","type":"method","signatures":[{"added":"1.7","params":[{"name":"events","type":"String","optional":"","desc":"One or more space-separated event types and optional namespaces, such as \"click\" or \"keydown.myPlugin\"."},{"name":"selector","type":"String","optional":"optional","desc":"A selector string to filter the descendants of the selected elements that trigger the event. If the selector is <code>null<\/code> or omitted, the event is always triggered when it reaches the selected element."},{"name":"data","type":"Anything","optional":"optional","desc":"Data to be passed to the handler in <a href=\"http:\/\/api.jquery.com\/event.data\/\"><code>event.data<\/code><\/a> when an event is triggered."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute when the event is triggered. The value <code>false<\/code> is also allowed as a shorthand for a function that simply does <code>return false<\/code>."}]},{"added":"1.7","params":[{"name":"events-map","type":"Map","optional":"","desc":"A map in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s)."},{"name":"selector","type":"String","optional":"optional","desc":"A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element."},{"name":"data","type":"Anything","optional":"optional","desc":"Data to be passed to the handler in <a href=\"http:\/\/api.jquery.com\/event.data\/\"><code>event.data<\/code><\/a> when an event occurs."}]}],"desc":"Attach an event handler function for one or more events to the selected elements.","longdesc":"\n\n<p>The <code>.on()<\/code> method attaches event handlers to the currently selected set of elements in the jQuery object. As of jQuery 1.7, the <code>.on()<\/code> method provides all functionality required for attaching event handlers. For help in converting from older jQuery event methods, see <a href=\"http:\/\/api.jquery.com\/bind\/\"><code>.bind()<\/code><\/a>,  <a href=\"http:\/\/api.jquery.com\/delegate\/\"><code>.delegate()<\/code><\/a>, and <a href=\"http:\/\/api.jquery.com\/live\/\"><code>.live()<\/code><\/a>. To remove events bound with <code>.on()<\/code>, see <a href=\"http:\/\/api.jquery.com\/off\/\"><code>.off()<\/code><\/a>. To attach an event that runs only once and then removes itself, see <a href=\"http:\/\/api.jquery.com\/one\/\"><code>.one()<\/code><\/a><\/p>\n\n<h2 id=\"event-names\">Event names and namespaces<\/h2>\n\n<p>Any event names can be used for the <code>events<\/code> argument. jQuery will pass through the browser's standard JavaScript event types, calling the <code>handler<\/code> function when the browser generates events due to user actions such as <code>click<\/code>. In addition, the <a href=\"http:\/\/api.jquery.com\/trigger\/\"><code>.trigger()<\/code><\/a> method can trigger both standard browser event names and custom event names to call attached handlers.<\/p>\n\n<p>An event name can be qualified by <em>event namespaces<\/em> that simplify removing or triggering the event. For example, <code>\"click.myPlugin.simple\"<\/code> defines both the myPlugin and simple namespaces for this particular click event. A click event handler attached via that string could be removed with <code>.off(\"click.myPlugin\")<\/code> or <code>.off(\"click.simple\")<\/code> without disturbing other click handlers attached to the elements. Namespaces are similar to CSS classes in that they are not hierarchical; only one name needs to match. Namespaces beginning with an underscore are reserved for jQuery's use.<\/p>\n\n<p>In the second form of <code>.on()<\/code>, the <code>events-map<\/code> argument is a JavaScript Object, or \"map\". The keys are strings in the same form as the <code>events<\/code> argument with space-separated event type names and optional namespaces. The value for each key is a function (or <code>false<\/code> value) that is used as the <code>handler<\/code> instead of the final argument to the method. In other respects, the two forms are identical in their behavior as described below.<\/p>\n\n<h2 id=\"direct-and-delegated-events\">Direct and delegated events<\/h2>\n\n<p>The majority of browser events <em>bubble<\/em>, or <em>propagate<\/em>, from the deepest, innermost element (the <strong>event target<\/strong>) in the document where they occur all the way up to the body and the <code>document<\/code> element. In Internet Explorer 8 and lower, a few events such as <code>change<\/code> and <code>submit<\/code> do not natively bubble but jQuery patches these to bubble and create consistent cross-browser behavior.<\/p>\n\n<p>If <code>selector<\/code> is omitted or is null, the event handler is referred to as <em>direct<\/em> or <em>directly-bound<\/em>. The handler is called every time an event occurs on the selected elements, whether it occurs directly on the element or bubbles from a descendant (inner) element.<\/p>\n\n<p>When a <code>selector<\/code> is provided, the event handler is referred to as <em>delegated<\/em>. The handler is not called when the event occurs directly on the bound element, but only for descendants (inner elements) that match the selector. jQuery bubbles the event from the event target up to the element where the handler is attached (i.e., innermost to outermost element) and runs the handler for any elements along that path matching the selector.<\/p>\n\n<p><strong>Event handlers are bound only to the currently selected elements; they must exist on the page at the time your code makes the call to <code>.on()<\/code>.<\/strong> To ensure the elements are present and can be selected, perform event binding inside a document ready handler for elements that are in the HTML markup on the page. If new HTML is being injected into the page, select the elements and attach event handlers <em>after<\/em> the new HTML is placed into the page. Or, use delegated events to attach an event handler, as described next.<\/p>\n\n<p>Delegated events have the advantage that they can process events from <em>descendant elements<\/em> that are added to the document at a later time. By picking an element that is guaranteed to be present at the time the delegated event handler is attached, you can use delegated events to avoid the need to frequently attach and remove event handlers. This element could be the container element of a view in a Model-View-Controller design, for example, or <code>document<\/code> if the event handler wants to monitor all bubbling events in the document. The <code>document<\/code> element is available in the <code>head<\/code> of the document before loading any other HTML, so it is safe to attach events there without waiting for the document to be ready.<\/p>\n\n<p>In addition to their ability to handle events on descendant elements not yet created, another advantage of delegated events is their potential for much lower overhead when many elements must be monitored. On a data table with 1,000 rows in its <code>tbody<\/code>, this example attaches a handler to 1,000 elements:<\/p>\n<pre>\n$(\"#dataTable tbody tr\").on(\"click\", function(event){\n\talert($(this).text());\n});\n<\/pre>\n<p>A delegated-events approach attaches an event handler to only one element, the tbody, and the event only needs to bubble up one level (from the clicked <code>tr<\/code> to <code>tbody<\/code>):<\/p>\n<pre>\n$(\"#dataTable tbody\").on(\"click\", \"tr\", function(event){\n\talert($(this).text());\n});\n<\/pre>\n\n<h2 id=\"event-handler\">The event handler and its environment<\/h2>\n\n<p>The <code>handler<\/code> argument is a function (or the value <code>false<\/code>, see below), and is required unless the <code>events-map<\/code> form is used. You can provide an anonymous handler function at the point of the <code>.on()<\/code> call, as the examples have done above, or declare a named function and pass its name:<\/p>\n<pre>\nfunction notify() { alert(\"clicked\"); }\n$(\"button\").on(\"click\", notify);\n<\/pre>\n\n<p>When the browser triggers an event or other JavaScript calls jQuery's <code>.trigger()<\/code> method, jQuery passes the handler an <a href=\"http:\/\/api.jquery.com\/category\/event-object\/\"><code>event object<\/code><\/a> it can use to analyze and change the status of the event. This object includes a <em>normalized subset<\/em> of data provided by the browser; the browser's unmodified native event object is available in <code>event.originalEvent<\/code>. For example, <a href=\"http:\/\/api.jquery.com\/event.type\"><code>event.type<\/code><\/a> contains the event name (e.g., \"resize\") and <a href=\"http:\/\/api.jquery.com\/event.target\"><code>event.target<\/code><\/a> indicates the deepest (innermost) element where the event occurred.<\/p>\n\n<p>By default, most events bubble up from the original event target to the <code>document<\/code> element. At each element along the way, jQuery calls any matching event handlers that have been attached. A handler can prevent the event from bubbling further up the document tree (and thus prevent handlers on those elements from running) by calling <code>event.stopPropagation()<\/code>. Any other handlers attached on the current element <em>will<\/em> run however. To prevent that, call <code>event.stopImmediatePropagation()<\/code>. (Event handlers bound to an element are called in the same order that they were bound.)<\/p>\n\n<p>Similarly, a handler can call <code>event.preventDefault()<\/code> to cancel any default action that the browser may have for this event; for example, the default action on a <code>click<\/code> event is to follow the link. Not all browser events have default actions, and not all default actions can be canceled. See the <a href=\"http:\/\/www.w3.org\/TR\/DOM-Level-3-Events\/#event-types-list\">W3C Events Specification<\/a> for details.<\/p>\n\n<p>Returning <code>false<\/code> from an event handler will automatically call <code>event.stopPropagation()<\/code> and <code>event.preventDefault()<\/code>. A <code>false<\/code> value can also be passed for the <code>handler<\/code> as a shorthand for <code>function(){ return false; }<\/code>. So, <code>$(\"a.disabled\").on(\"click\", false);<\/code> attaches an event handler to all links with class \"disabled\" that prevents them from being followed when they are clicked and also stops the event from bubbling. <\/p>\n\n<p>When jQuery calls a handler, the <code>this<\/code> keyword is a reference to the element where the event is being delivered; for directly bound events this is the element where the event was attached and for delegated events this is an element matching <code>selector<\/code>. (Note that <code>this<\/code> may not be equal to <code>event.target<\/code> if the event has bubbled from a descendant element.) To create a jQuery object from the element so that it can be used with jQuery methods, use <code>$(this)<\/code>.<\/p>\n\n<h2 id=\"passing-data\">Passing data to the handler<\/h2>\n\n<p>If a <code>data<\/code> argument is provided to <code>.on()<\/code> and is not <code>null<\/code> or <code>undefined<\/code>, it is passed to the handler in the <a href=\"http:\/\/api.jquery.com\/event.data\/\"><code>event.data<\/code><\/a> property each time an event is triggered. The <code>data<\/code> argument can be any type, but if a string is used the <code>selector<\/code> must either be provided or explicitly passed as <code>null<\/code> so that the data is not mistaken for a selector. Best practice is to use an object (map) so that multiple values can be passed as properties.<\/p>\n\n<p>As of jQuery 1.4, the same event handler can be bound to an element multiple times. This is especially useful when the <code>event.data<\/code> feature is being used, or when other unique data resides in a closure around the event handler function. For example:<\/p>\n<pre>\nfunction greet(event) { alert(\"Hello \"+event.data.name); }\n$(\"button\").on(\"click\", { name: \"Karl\" }, greet);\n$(\"button\").on(\"click\", { name: \"Addy\" }, greet);\n<\/pre>\n<p>The above code will generate two different alerts when the button is clicked.<\/p>\n\n<p>As an alternative or in addition to the <code>data<\/code> argument provided to the <code>.on()<\/code> method, you can also pass data to an event handler using a second argument to <a href=\"http:\/\/api.jquery.com\/trigger\/\">.trigger()<\/a> or <a href=\"http:\/\/api.jquery.com\/triggerHandler\/\">.triggerHandler()<\/a>.<\/p>\n\n<h2 id=\"event-performance\">Event performance<\/h2>\n\n<p>In most cases, an event such as <code>click<\/code> occurs infrequently and performance is not a significant concern. However, high frequency events such as <code>mousemove<\/code> or <code>scroll<\/code> can fire dozens of times per second, and in those cases it becomes more important to use events judiciously. Performance can be increased by reducing the amount of work done in the handler itself, caching information needed by the handler rather than recalculating it, or by rate-limiting the number of actual page updates using <code>setTimeout<\/code>.<\/p>\n\n<p>Attaching many delegated event handlers near the top of the document tree can degrade performance. Each time the event occurs, jQuery must compare all selectors of all attached events of that type to every element in the path from the event target up to the top of the document. For best performance, attach delegated events at a document location as close as possible to the target elements. Avoid excessive use of <code>document<\/code> or <code>document.body<\/code> for delegated events on large documents.<\/p>\n\n<p>jQuery can process simple selectors of the form <code>tag#id.class<\/code> very quickly when they are used to filter delegated events. So, <code>\"#myForm\"<\/code>, <code>\"a.external\"<\/code>, and <code>\"button\"<\/code> are all fast selectors. Delegated events that use more complex selectors, particularly hierarchical ones, can be several times slower--although they are still fast enough for most applications. Hierarchical selectors can often be avoided simply by attaching the handler to a more appropriate point in the document. For example, instead of <code>$(\"body\").on(\"click\", \"#commentForm .addNew\", addComment)<\/code> use <code>$(\"#commentForm\").on(\"click\", \".addNew\", addComment)<\/code>.<\/p>\n\n<h2 id=\"additional-notes\">Additional notes<\/h2>\n\n<p>There are shorthand methods for some events such as <a href=\"http:\/\/api.jquery.com\/click\/\"><code>.click()<\/code><\/a> that can be used to attach or trigger event handlers. For a complete list of shorthand methods, see the <a href=\"http:\/\/api.jquery.com\/category\/events\/\">events category<\/a>.<\/p>\n\n<p>Although strongly discouraged for new code, you may see the pseudo-event-name <code>\"hover\"<\/code> used as a shorthand for the string <code>\"mouseenter mouseleave\"<\/code>. It attaches a <em>single event handler<\/em> for those two events, and the handler must examine <code>event.type<\/code> to determine whether the event is <code>mouseenter<\/code> or <code>mouseleave<\/code>. Do not confuse the \"hover\" pseudo-event-name with the <a href=\"http:\/\/api.jquery.com\/hover\/\"><code>.hover()<\/code><\/a> method, which accepts <em>one or two<\/em> functions.<\/p>\n\n<p>jQuery's event system requires that a DOM element allow attaching data via a property on the element, so that events can be tracked and delivered. The <code>object<\/code>, <code>embed<\/code>, and <code>applet<\/code> elements cannot attach data, and therefore cannot have jQuery events bound to them.<\/p>\n\n<p>The <code>focus<\/code> and <code>blur<\/code> events are specified by the W3C to not bubble, but jQuery defines cross-browser <code>focusin<\/code> and <code>focusout<\/code> events that do bubble. When <code>focus<\/code> and <code>blur<\/code> are used to attach delegated event handlers, jQuery maps the names and delivers them as <code>focusin<\/code> and <code>focusout<\/code> respectively. For consistency and clarity, use the bubbling event type names.<\/p>\n\n<p>jQuery also specifically prevents right and middle clicks from bubbling as they don't occur on the element being clicked. Should working with the middle click be required, the <code>mousedown<\/code> or <code>mouseup<\/code> events should be used with <code>.on()<\/code> instead.<\/p>\n\n<p>In all browsers, the <code>load<\/code> event does not bubble. In Internet Explorer 8 and lower, the <code>paste<\/code> and <code>reset<\/code> events do not bubble. Such events are not supported for use with delegation, but they <em>can<\/em> be used when the event handler is directly attached to the element generating the event.<\/p>\n\n<p>The <code>error<\/code> event on the <code>window<\/code> object uses nonstandard arguments and return value conventions, so it is not supported by jQuery. Instead, assign a handler function directly to the <code>window.onerror<\/code> property.<\/p>\n\n\n\n","categories":["Events > Event Handler Attachment","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/one\/","name":"one","title":".one()","type":"method","signatures":[{"added":"1.1","params":[{"name":"events","type":"String","optional":"","desc":"A string containing one or more JavaScript event types, such as \"click\" or \"submit,\" or custom event names."},{"name":"data","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute at the time the event is triggered."}]},{"added":"1.7","params":[{"name":"events","type":"String","optional":"","desc":"One or more space-separated event types and optional namespaces, such as \"click\" or \"keydown.myPlugin\"."},{"name":"selector","type":"String","optional":"optional","desc":"A selector string to filter the descendants of the selected elements that trigger the event. If the selector is <code>null<\/code> or omitted, the event is always triggered when it reaches the selected element."},{"name":"data","type":"Anything","optional":"optional","desc":"Data to be passed to the handler in <a href=\"\/event.data\"><code>event.data<\/code><\/a> when an event is triggered."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute when the event is triggered. The value <code>false<\/code> is also allowed as a shorthand for a function that simply does <code>return false<\/code>."}]},{"added":"1.7","params":[{"name":"events-map","type":"Map","optional":"","desc":"A map in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s)."},{"name":"selector","type":"String","optional":"optional","desc":"A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element."},{"name":"data","type":"Anything","optional":"optional","desc":"Data to be passed to the handler in <a href=\"http:\/\/api.jquery.com\/event.data\"><code>event.data<\/code><\/a> when an event occurs."}]}],"desc":"Attach a handler to an event for the elements. The handler is executed at most once per element.","longdesc":"\n<p>The first form of this method is identical to <code>.bind()<\/code>, except that the handler is unbound after its first invocation. The second two forms, introduced in jQuery 1.7, are identical to <code>.on()<\/code> except that the handler is removed after the first time a selector match occurs at the delegated element. For example:<\/p>\n<pre>$(\"#foo\").one(\"click\", function() {\n  alert(\"This will be displayed only once.\");\n});\n$(\"body\").one(\"click\", \".foo\", function() {\n  alert(\"This displays once for the first .foo clicked in the body.\");\n});\n<\/pre>\n<p>After the code is executed, a click on the element with ID <code>foo<\/code> will display the alert. Subsequent clicks will do nothing. This code is equivalent to:<\/p>\n<pre>$(\"#foo\").bind(\"click\", function( event ) {\n  alert(\"This will be displayed only once.\");\n  $(this).unbind( event );\n});\n<\/pre>\n<p>In other words, explicitly calling <code>.unbind()<\/code> from within a regularly-bound handler has exactly the same effect.<\/p>\n<p>If the first argument contains more than one space-separated event types, the event handler is called <em>once for each event type<\/em>.<\/p>\n","categories":["Events > Event Handler Attachment","Version > Version 1.1"],"download":""},{"url":"http:\/\/api.jquery.com\/only-child-selector\/","name":"only-child","title":":only-child Selector","type":"selector","signatures":[{"added":"1.1.4"}],"desc":"Selects all elements that are the only child of their parent.","longdesc":"<p>If the parent has other child elements, nothing is matched.<\/p>","categories":["Selectors > Child Filter","Version > Version 1.1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/outerHeight\/","name":"outerHeight","title":".outerHeight()","type":"method","signatures":[{"added":"1.2.6","params":[{"name":"includeMargin","type":"Boolean","optional":"optional","desc":"A Boolean indicating whether to include the element's margin in the calculation."}]}],"desc":"Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without \"px\") representation of the value or null if called on an empty set of elements.","longdesc":"<p>The top and bottom padding and border are always included in the <code>.outerHeight()<\/code> calculation; if the <code>includeMargin<\/code> argument is set to <code>true<\/code>, the margin (top and bottom) is also included.<\/p>\n\t\t\t\t<p>This method is not applicable to <code>window<\/code> and <code>document<\/code> objects; for these, use <code><a href=\"\/height\">.height()<\/a><\/code> instead.<\/p>\n\t\t\t\t<p class=\"image\"><img src=\"\/images\/0042_04_03.png\"\/><\/p>","categories":["CSS","Dimensions","Manipulation > Style Properties","Version > Version 1.2.6"],"download":""},{"url":"http:\/\/api.jquery.com\/outerWidth\/","name":"outerWidth","title":".outerWidth()","type":"method","signatures":[{"added":"1.2.6","params":[{"name":"includeMargin","type":"Boolean","optional":"optional","desc":"A Boolean indicating whether to include the element's margin in the calculation."}]}],"desc":"Get the current computed width for the first element in the set of matched elements, including padding and border.","longdesc":"<p>Returns the width of the element, along with left and right padding, border, and optionally margin, in pixels.<\/p>\n\t\t\t\t<p>If <code>includeMargin<\/code> is omitted or <code>false<\/code>, the padding and border are included in the calculation; if <code>true<\/code>, the margin is also included.<\/p>\n\t\t\t\t<p>This method is not applicable to <code>window<\/code> and <code>document<\/code> objects; for these, use <code><a href=\"\/width\">.width()<\/a><\/code> instead.<\/p>\n\t\t\t\t<p class=\"image\"><img src=\"\/images\/0042_04_06.png\"\/><\/p>","categories":["CSS","Dimensions","Manipulation > Style Properties","Version > Version 1.2.6"],"download":""},{"url":"http:\/\/api.jquery.com\/parent\/","name":"parent","title":".parent()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get the parent of each element in the current set of matched elements, optionally filtered by a selector.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.parent()<\/code> method allows us to search through the parents of these elements in the DOM tree and construct a new jQuery object from the matching elements. The <code>.parents()<\/code> and <code>.parent()<\/code> methods are similar, except that the latter only travels a single level up the DOM tree.<\/p>\n<p>The method optionally accepts a selector expression of the same type that we can pass to the <code>$()<\/code> function. If the selector is supplied, the elements will be filtered by testing whether they match it.<\/p>\n<p>Consider a page with a basic nested list on it:<\/p>\n<pre>\n&lt;ul class=\"level-1\"&gt;\n  &lt;li class=\"item-i\"&gt;I&lt;\/li&gt;\n  &lt;li class=\"item-ii\"&gt;II\n    &lt;ul class=\"level-2\"&gt;\n      &lt;li class=\"item-a\"&gt;A&lt;\/li&gt;\n      &lt;li class=\"item-b\"&gt;B\n        &lt;ul class=\"level-3\"&gt;\n          &lt;li class=\"item-1\"&gt;1&lt;\/li&gt;\n          &lt;li class=\"item-2\"&gt;2&lt;\/li&gt;\n          &lt;li class=\"item-3\"&gt;3&lt;\/li&gt;\n        &lt;\/ul&gt;\n      &lt;\/li&gt;\n      &lt;li class=\"item-c\"&gt;C&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/li&gt;\n  &lt;li class=\"item-iii\"&gt;III&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>If we begin at item A, we can find its parents:<\/p>\n<pre>$('li.item-a').parent().css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background for the level-2 list. Since we do not supply a selector expression, the parent element is unequivocally included as part of the object. If we had supplied one, the element would be tested for a match before it was included.<\/p>","categories":["Traversing > Tree Traversal","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/parent-selector\/","name":"parent","title":":parent Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Select all elements that are the parent of another element, including text nodes.","longdesc":"\n    <p>This is the inverse of <code>:empty<\/code>. <\/p>\n<p>One important thing to note regarding the use of <code>:parent<\/code> (and <code>:empty<\/code>) is that child elements include text nodes.<\/p>\n<p>The W3C recommends that the <code>&lt;p&gt;<\/code> element have at least one child node, even if that child is merely text (see <a href=\"http:\/\/www.w3.org\/TR\/html401\/struct\/text.html#edef-P\">http:\/\/www.w3.org\/TR\/html401\/struct\/text.html#edef-P<\/a>). Some other elements, on the other hand, are empty (i.e. have no children) by definition:<code> &lt;input&gt;<\/code>, <code>&lt;img&gt;<\/code>, <code>&lt;br&gt;<\/code>, and <code>&lt;hr&gt;<\/code>, for example.<\/p>\n    \n  ","categories":["Selectors > Content Filter","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/parents\/","name":"parents","title":".parents()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.parents()<\/code> method allows us to search through the ancestors of these elements in the DOM tree and construct a new jQuery object from the matching elements ordered from immediate parent on up; the elements are returned in order from the closest parent to the outer ones. The <code>.parents()<\/code> and <code><a href=\"http:\/\/api.jquery.com\/parent\/\">.parent()<\/a><\/code> methods are similar, except that the latter only travels a single level up the DOM tree.<\/p>\n<p>The method optionally accepts a selector expression of the same type that we can pass to the <code>$()<\/code> function. If the selector is supplied, the elements will be filtered by testing whether they match it.<\/p>\n<p>Consider a page with a basic nested list on it:<\/p>\n<pre>\n&lt;ul class=\"level-1\"&gt;\n  &lt;li class=\"item-i\"&gt;I&lt;\/li&gt;\n  &lt;li class=\"item-ii\"&gt;II\n    &lt;ul class=\"level-2\"&gt;\n      &lt;li class=\"item-a\"&gt;A&lt;\/li&gt;\n      &lt;li class=\"item-b\"&gt;B\n        &lt;ul class=\"level-3\"&gt;\n          &lt;li class=\"item-1\"&gt;1&lt;\/li&gt;\n          &lt;li class=\"item-2\"&gt;2&lt;\/li&gt;\n          &lt;li class=\"item-3\"&gt;3&lt;\/li&gt;\n        &lt;\/ul&gt;\n      &lt;\/li&gt;\n      &lt;li class=\"item-c\"&gt;C&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/li&gt;\n  &lt;li class=\"item-iii\"&gt;III&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>If we begin at item A, we can find its ancestors:<\/p>\n<pre>$('li.item-a').parents().css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background for the level-2 list, item II, and the level-1 list (and on up the DOM tree all the way to the <code>&lt;html&gt;<\/code> element). Since we do not supply a selector expression, all of the ancestors are part of the returned jQuery object. If we had supplied one, only the matching items among these would be included.<\/p>","categories":["Traversing > Tree Traversal","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/parentsUntil\/","name":"parentsUntil","title":".parentsUntil()","type":"method","signatures":[{"added":"1.4","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A string containing a selector expression to indicate where to stop matching ancestor elements."},{"name":"filter","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]},{"added":"1.6","params":[{"name":"element","type":"Element","optional":"optional","desc":"A DOM node or jQuery object indicating where to stop matching ancestor elements."},{"name":"filter","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.","longdesc":"<p>Given a selector expression that represents a set of DOM elements, the <code>.parentsUntil()<\/code> method traverses through the ancestors of these elements until it reaches an element matched by the selector passed in the method's argument. The resulting jQuery object contains all of the ancestors up to but not including the one matched by the <code>.parentsUntil()<\/code> selector.<\/p>\n    <p>If the selector is not matched or is not supplied, all ancestors will be selected; in these cases it selects the same elements as the <code>.parents()<\/code> method does when no selector is provided.<\/p>\n    <p><strong>As of jQuery 1.6<\/strong>, A DOM node or jQuery object, instead of a selector, may be used for the first <strong>.parentsUntil()<\/strong> argument.<\/p>\n    <p>The method optionally accepts a selector expression for its second argument. If this argument is supplied, the elements will be filtered by testing whether they match it.<\/p>\n","categories":["Traversing > Tree Traversal","Version > Version 1.4","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/password-selector\/","name":"password","title":":password Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements of type password.","longdesc":"<p><code>$(':password')<\/code> is equivalent to <code>$('[type=password]')<\/code>. As with other pseudo-class selectors (those that begin with a \":\") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector (\"*\") is implied. In other words, the bare <code>$(':password')<\/code> is equivalent to <code>$('*:password')<\/code>, so <code>$('input:password')<\/code> should be used instead. <\/p>","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/position\/","name":"position","title":".position()","type":"method","signatures":[{"added":"1.2"}],"desc":"Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.","longdesc":"<p>The <code>.position()<\/code> method allows us to retrieve the current position of an element <em>relative to the offset parent<\/em>. Contrast this with <code><a href=\"\/offset\">.offset()<\/a><\/code>, which retrieves the current position <em>relative to the document<\/em>. When positioning a new element near another one and within the same containing DOM element, <code>.position()<\/code> is the more useful.<\/p>\n<p>Returns an object containing the properties <code>top<\/code> and <code>left<\/code>.<\/p>\n<blockquote><p><strong>Note:<\/strong> jQuery does not support getting the position coordinates of hidden elements or accounting for borders, margins, or padding set on the body element.<\/p><\/blockquote>\n","categories":["CSS","Offset","Manipulation > Style Properties","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/prepend\/","name":"prepend","title":".prepend()","type":"method","signatures":[{"added":"1.0","params":[{"name":"content","type":"String, Element, jQuery","optional":"","desc":"DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements."},{"name":"content","type":"String, Element, jQuery","optional":"optional","desc":"One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements."}]},{"added":"1.4","params":[{"name":"function(index, html)","type":"Function","optional":"","desc":"A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, <code>this<\/code> refers to the current element in the set."}]}],"desc":"Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.","longdesc":"<p>The <code>.prepend()<\/code> method inserts the specified content as the first child of each element in the jQuery collection (To insert it as the <em>last<\/em> child, use <a href=\"http:\/\/api.jquery.com\/append\/\"><code>.append()<\/code><\/a>). <\/p>\n    <p>The <code>.prepend()<\/code> and <code><a href=\"\/prependTo\">.prependTo()<\/a><\/code> methods perform the same task. The major difference is in the syntax\u2014specifically, in the placement of the content and target. With<code> .prepend()<\/code>, the selector expression preceding the method is the container into which the content is inserted. With <code>.prependTo()<\/code>, on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted into the target container.<\/p>\n    <p>Consider the following HTML:<\/p>\n    <pre>&lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n    <p>You can create content and insert it into several elements at once:<\/p>\n    <pre>$('.inner').prepend('&lt;p&gt;Test&lt;\/p&gt;');<\/pre>\n    <p>Each <code>&lt;div class=\"inner\"&gt;<\/code> element gets this new content:<\/p>\n    <pre>&lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;\n    &lt;p&gt;Test&lt;\/p&gt;\n    Hello\n  &lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;\n    &lt;p&gt;Test&lt;\/p&gt;\n    Goodbye\n  &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n  <p>You can also select an element on the page and insert it into another:<\/p>\n  <pre>$('.container').prepend($('h2'));<\/pre>\n  <p>If <em>a single element<\/em> selected this way is inserted elsewhere, it will be moved into the target (<em>not cloned<\/em>):<\/p>\n  <pre>&lt;div class=\"container\"&gt;\n    &lt;h2&gt;Greetings&lt;\/h2&gt;\n    &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n    &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n    <p><strong>Important<\/strong>: If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first.<\/p>\n    <h4 id=\"additional-arguments\">Additional Arguments<\/h4>\n    <p>Similar to other content-adding methods such as <code><a href=\"http:\/\/api.jquery.com\/append\/\">.append()<\/a><\/code> and <code><a href=\"http:\/\/api.jquery.com\/before\/\">.before()<\/a><\/code>, <code>.prepend()<\/code> also supports passing in multiple arguments as input. Supported input includes DOM elements, jQuery objects, HTML strings, and arrays of DOM elements.<\/p> \n    <p>For example, the following will insert two new <code>&lt;div&gt;<\/code>s and an existing <code>&lt;div&gt;<\/code> as the first three child nodes of the body:<\/p>\n<pre>var $newdiv1 = $('&lt;div id=\"object1\"\/&gt;'),\n    newdiv2 = document.createElement('div'),\n    existingdiv1 = document.getElementById('foo');\n\n$('body').prepend($newdiv1, [newdiv2, existingdiv1]);\n<\/pre>\n<p>Since <code>.prepend()<\/code> can accept any number of additional arguments, the same result can be achieved by passing in the three <code>&lt;div&gt;<\/code>s as three separate arguments, like so: <code>$('body').prepend($newdiv1, newdiv2, existingdiv1)<\/code>. The type and number of arguments will largely depend on how you collect the elements in your code.<\/p>\n  ","categories":["Manipulation > DOM Insertion"," Inside","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/prependTo\/","name":"prependTo","title":".prependTo()","type":"method","signatures":[{"added":"1.0","params":[{"name":"target","type":"Selector, Element, jQuery","optional":"","desc":"A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter."}]}],"desc":"Insert every element in the set of matched elements to the beginning of the target.","longdesc":"<p>The <code><a href=\"\/prepend\">.prepend()<\/a><\/code> and <code>.prependTo()<\/code> methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With<code> .prepend()<\/code>, the selector expression preceding the method is the container into which the content is inserted. With <code>.prependTo()<\/code>, on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted into the target container.<\/p>\n\t\t\t\t<p>Consider the following HTML:<\/p>\n\t\t\t\t<pre>&lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>We can create content and insert it into several elements at once:<\/p>\n\t\t\t\t<pre>$('&lt;p&gt;Test&lt;\/p&gt;').prependTo('.inner');<\/pre>\n\t\t\t\t<p>Each inner <code>&lt;div&gt;<\/code> element gets this new content:<\/p>\n\t\t\t\t<pre>&lt;h2&gt;Greetings&lt;\/h2&gt;\n&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;\n    &lt;p&gt;Test&lt;\/p&gt;\n    Hello\n  &lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;\n    &lt;p&gt;Test&lt;\/p&gt;\n    Goodbye\n  &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>We can also select an element on the page and insert it into another:<\/p>\n\t\t\t\t<pre>$('h2').prependTo($('.container'));<\/pre>\n\t\t\t\t<p>If an element selected this way is inserted elsewhere, it will be moved into the target (not cloned):<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;Greetings&lt;\/h2&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first.<\/p>","categories":["Manipulation > DOM Insertion"," Inside","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/prev\/","name":"prev","title":".prev()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.prev()<\/code> method searches for the predecessor of each of these elements in the DOM tree and constructs a new jQuery object from the matching elements.<\/p>\n<p>The method optionally accepts a selector expression of the same type that can be passed to the <code>$()<\/code> function. If the selector is supplied, the preceding element will be filtered by testing whether it match the selector.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n&lt;ul&gt;\n   &lt;li&gt;list item 1&lt;\/li&gt;\n   &lt;li&gt;list item 2&lt;\/li&gt;\n   &lt;li class=\"third-item\"&gt;list item 3&lt;\/li&gt;\n   &lt;li&gt;list item 4&lt;\/li&gt;\n   &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>To select the element that comes immediately before item three:<\/p>\n<pre>$('li.third-item').prev().css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background behind item 2. Since no selector expression is supplied, this preceding element is unequivocally included as part of the object. If one had been supplied, the element would be tested for a match before it was included.<\/p>\n<p>If no previous sibling exists, or if the previous sibling element does not match a supplied selector, an empty jQuery object is returned.<\/p>\n<p>To select <em>all<\/em> preceding sibling elements, rather than just the preceding <em>adjacent<\/em> sibling, use the <a href=\"http:\/\/api.jquery.com\/prevAll\/\">.prevAll()<\/a> method.<\/p>\n","categories":["Traversing > Tree Traversal","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/prevAll\/","name":"prevAll","title":".prevAll()","type":"method","signatures":[{"added":"1.2","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.prevAll()<\/code> method searches through the predecessors of these elements in the DOM tree and construct a new jQuery object from the matching elements; the elements are returned in order beginning with the closest sibling.<\/p>\n<p>The method optionally accepts a selector expression of the same type that we can pass to the <code>$()<\/code> function. If the selector is supplied, the elements will be filtered by testing whether they match it.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n&lt;ul&gt;\n   &lt;li&gt;list item 1&lt;\/li&gt;\n   &lt;li&gt;list item 2&lt;\/li&gt;\n   &lt;li class=\"third-item\"&gt;list item 3&lt;\/li&gt;\n   &lt;li&gt;list item 4&lt;\/li&gt;\n   &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>If we begin at the third item, we can find the elements which come before it:<\/p>\n<pre>$('li.third-item').prevAll().css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background behind items 1 and 2. Since we do not supply a selector expression, these preceding elements are unequivocally included as part of the object. If we had supplied one, the elements would be tested for a match before they were included.<\/p>","categories":["Traversing > Tree Traversal","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/prevUntil\/","name":"prevUntil","title":".prevUntil()","type":"method","signatures":[{"added":"1.4","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A string containing a selector expression to indicate where to stop matching preceding sibling elements."},{"name":"filter","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]},{"added":"1.6","params":[{"name":"element","type":"Element","optional":"optional","desc":"A DOM node or jQuery object indicating where to stop matching preceding sibling elements."},{"name":"filter","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.","longdesc":"<p>Given a selector expression that represents a set of DOM elements, the <code>.prevUntil()<\/code> method searches through the predecessors of these elements in the DOM tree, stopping when it reaches an element matched by the method's argument. The new jQuery object that is returned contains all previous siblings up to but not including the one matched by the <code>.prevUntil()<\/code> selector; the elements are returned in order from the closest sibling to the farthest.<\/p>\n  <p>If the selector is not matched or is not supplied, all previous siblings will be selected; in these cases it selects the same elements as the <code>.prevAll()<\/code> method does when no filter selector is provided.<\/p>\n  <p><strong>As of jQuery 1.6<\/strong>, A DOM node or jQuery object, instead of a selector, may be used for the first <strong>.prevUntil()<\/strong> argument.<\/p>\n  <p>The method optionally accepts a selector expression for its second argument. If this argument is supplied, the elements will be filtered by testing whether they match it.<\/p>\n  ","categories":["Traversing > Tree Traversal","Version > Version 1.4","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/promise\/","name":"promise","title":".promise()","type":"","signatures":[{"added":"1.6","params":[{"name":"type","type":"String","optional":"optional","desc":" The type of queue that needs to be observed. "},{"name":"target","type":"Object","optional":"optional","desc":"Object onto which the promise methods have to be attached"}]}],"desc":" Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. ","longdesc":" <p>The <code>.promise()<\/code> method returns a dynamically generated Promise that is resolved once all actions of a certain type bound to the collection, queued or not, have ended.<\/p>\n  <p> By default, <code>type<\/code> is <code>\"fx\"<\/code>, which means the returned Promise is resolved when all animations of the selected elements have completed.<\/p>\n  <p> Resolve context and sole argument is the collection onto which <code>.promise()<\/code> has been called. <\/p>\n  <p> If <code>target<\/code> is provided, <code>.promise()<\/code> will attach the methods onto it and then return this object rather than create a new one. This can be useful to attach the Promise behavior to an object that already exists.<\/p>  \n<blockquote><p><strong>Note: <\/strong>The returned Promise is linked to a Deferred object stored on the <code>.data()<\/code> for an element. Since the <code>.remove()<\/code> method removes the element's data as well as the element itself, it will prevent any of the element's unresolved Promises from resolving. If it is necessary to remove an element from the DOM before its Promise is resolved, use <code>.detach()<\/code> instead and follow with <code>.removeData()<\/code> after resolution.<\/p><\/blockquote>\n","categories":["Deferred Object","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/prop\/","name":"prop","title":".prop()","type":"method","signatures":[{"added":"1.6","params":[{"name":"propertyName","type":"String","optional":"","desc":"The name of the property to get."}]}],"desc":"Get the value of a property for the first element in the set of matched elements.","longdesc":"<p>The <code>.prop()<\/code> method gets the property value for only the <em>first<\/em> element in the matched set. It returns <code>undefined<\/code> for the value of a property that has not been set, or if the matched set has no elements. To get the value for each element individually, use a looping construct such as jQuery's <code>.each()<\/code> or <code>.map()<\/code> method.<\/p>\n    <p>The difference between <em>attributes<\/em> and <em>properties<\/em> can be important in specific situations. <strong>Before jQuery 1.6<\/strong>, the <code><a href=\"http:\/\/api.jquery.com\/attr\/\">.attr()<\/a><\/code> method sometimes took property values into account when retrieving some attributes, which could cause inconsistent behavior. <strong>As of jQuery 1.6<\/strong>, the <code>.prop()<\/code> method provides a way to explicitly retrieve property values, while <code>.attr()<\/code> retrieves attributes.<\/p>\n\n<p>For example, <code>selectedIndex<\/code>, <code>tagName<\/code>, <code>nodeName<\/code>, <code>nodeType<\/code>, <code>ownerDocument<\/code>, <code>defaultChecked<\/code>, and <code>defaultSelected<\/code> should be retrieved and set with the <code>.prop()<\/code> method. Prior to jQuery 1.6, these properties were retrievable with the <code>.attr()<\/code> method, but this was not within the scope of <code>attr<\/code>. These do not have corresponding attributes and are only properties.<\/p>\n\n<p>Concerning boolean attributes, consider a DOM element defined by the HTML markup <code>&lt;input type=\"checkbox\" checked=\"checked\" \/&gt;<\/code>, and assume it is in a JavaScript variable named <code>elem<\/code>:<\/p>\n<table class=\"listing\">\n <tr>\n  <th><code>elem.checked<\/code><\/th>\n  <td><code>true<\/code> (Boolean) Will change with checkbox state<\/td>\n <\/tr>\n <tr>\n  <th><code>$(elem).prop(\"checked\")<\/code><\/th>\n  <td><code>true<\/code> (Boolean) Will change with checkbox state<\/td>\n <\/tr>\n <tr>\n  <th><code>elem.getAttribute(\"checked\")<\/code><\/th>\n  <td><code>\"checked\"<\/code> (String) Initial state of the checkbox; does not change<\/td>\n <\/tr>\n <tr>\n  <th><code>$(elem).attr(\"checked\")<\/code><em>(1.6)<\/em><\/th>\n  <td><code>\"checked\"<\/code> (String) Initial state of the checkbox; does not change<\/td>\n <\/tr>\n <tr>\n  <th><code>$(elem).attr(\"checked\")<\/code><em>(1.6.1+)<\/em><\/th>\n  <td><code>\"checked\"<\/code> (String) Will change with checkbox state<\/td>\n <\/tr>\n <tr>\n  <th><code>$(elem).attr(\"checked\")<\/code><em>(pre-1.6)<\/em><\/th>\n  <td><code>true<\/code> (Boolean) Changed with checkbox state<\/td>\n <\/tr>\n<\/table>\n<p>\nAccording to the <a href=\"http:\/\/www.w3.org\/TR\/html401\/interact\/forms.html#h-17.4\">W3C forms specification<\/a>, the <code>checked<\/code> attribute is a <em><a href=\"http:\/\/www.w3.org\/TR\/html4\/intro\/sgmltut.html#h-3.3.4.2\">boolean attribute<\/a><\/em>, which means the corresponding property is true if the attribute is present at all\u2014even if, for example, the attribute has no value or an empty string value. The preferred cross-browser-compatible way to determine if a checkbox is checked is to check for a \"truthy\" value on the element's property using one of the following:<\/p>\n  <ul>\n    <li><code>if ( elem.checked )<\/code><\/li>\n    <li><code>if ( $(elem).prop(\"checked\") )<\/code><\/li>\n    <li><code>if ( $(elem).is(\":checked\") )<\/code><\/li>\n  <\/ul>\n<p>If using jQuery 1.6, the code <code>if ( $(elem).attr(\"checked\") )<\/code> will retrieve the actual content <em>attribute<\/em>, which does not change as the checkbox is checked and unchecked. It is meant only to store the default or initial value of the checked property. To maintain backwards compatability, the <code>.attr()<\/code> method in jQuery 1.6.1+ will retrieve and update the property for you so no code for boolean attributes is required to be changed to <code>.prop()<\/code>.  Nevertheless, the preferred way to retrieve a checked value is with one of the options listed above. To see how this works in the latest jQuery, check\/uncheck the checkbox in the example below.<\/p>\n  ","categories":["Attributes","Manipulation > General Attributes","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/prop\/","name":"prop","title":".prop()","type":"method","signatures":[{"added":"1.6","params":[{"name":"propertyName","type":"String","optional":"","desc":"The name of the property to set."},{"name":"value","type":"String, Number, Boolean","optional":"","desc":"A value to set for the property."}]},{"added":"1.6","params":[{"name":"map","type":"Map","optional":"","desc":"A map of property-value pairs to set."}]},{"added":"1.6","params":[{"name":"propertyName","type":"String","optional":"","desc":"The name of the property to set."},{"name":"function(index, oldPropertyValue)","type":"Function","optional":"","desc":"A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword <code>this<\/code> refers to the current element."}]}],"desc":"Set one or more properties for the set of matched elements.","longdesc":"<p>The <code>.prop()<\/code> method is a convenient way to set the value of properties\u2014especially when setting multiple properties, using values returned by a function, or setting values on multiple elements at once. It should be used when setting <code>selectedIndex<\/code>, <code>tagName<\/code>, <code>nodeName<\/code>, <code>nodeType<\/code>, <code>ownerDocument<\/code>, <code>defaultChecked<\/code>, or <code>defaultSelected<\/code>. Since jQuery 1.6, these properties can no longer be set with the <code>.attr()<\/code> method. They do not have corresponding attributes and are only properties.<\/p>\n  <p>Properties generally affect the dynamic state of a DOM element without changing the serialized HTML attribute. Examples include the <code>value<\/code> property of input elements, the <code>disabled<\/code> property of inputs and buttons, or the <code>checked<\/code> property of a checkbox. The <code>.prop()<\/code> method should be used to set disabled and checked instead of the <code><a href=\"http:\/\/api.jquery.com\/attr\">.attr()<\/a><\/code> method. The <code><a href=\"http:\/\/api.jquery.com\/val\">.val()<\/a><\/code> method should be used for getting and setting value.<\/p>\n<pre>\n$(\"input\").prop(\"disabled\", false);\n$(\"input\").prop(\"checked\", true);\n$(\"input\").val(\"someValue\");\n<\/pre>\n<p><strong>Important:<\/strong> the <code><a href=\"http:\/\/api.jquery.com\/removeProp\">.removeProp()<\/a><\/code> method should not be used to set these properties to false. Once a native property is removed, it cannot be added again. See <code><a href=\"http:\/\/api.jquery.com\/removeProp\">.removeProp()<\/a><\/code> for more information.<\/p>\n\n<h4 id=\"computed-prop-values\">Computed property values<\/h4>\n<p>By using a function to set properties, you can compute the value based on other properties of the element. For example, to toggle all checkboxes based off their individual values:<\/p>\n<pre>$(\"input[type='checkbox']\").prop(\"checked\", function( i, val ) {\n  return !val;\n});<\/pre>\n  <p><strong>Note: <\/strong>If nothing is returned in the setter function (ie. <code>function(index, prop){})<\/code>, or if <code>undefined<\/code> is returned, the current value is not changed. This is useful for selectively setting values only when certain criteria are met.<\/p>\n","categories":["Attributes","Manipulation > General Attributes","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/pushStack\/","name":"pushStack","title":".pushStack()","type":"method","signatures":[{"added":"1.0","params":[{"name":"elements","type":"Array","optional":"","desc":"An array of elements to push onto the stack and make into a new jQuery object."}]},{"added":"1.3","params":[{"name":"elements","type":"Array","optional":"","desc":"An array of elements to push onto the stack and make into a new jQuery object."},{"name":"name","type":"String","optional":"","desc":"The name of a jQuery method that generated the array of elements."},{"name":"arguments","type":"Array","optional":"","desc":"The arguments that were passed in to the jQuery method (for serialization)."}]}],"desc":"Add a collection of DOM elements onto the jQuery stack.","longdesc":"<longdesc\/>","categories":["Internals","Version > Version 1.0","Version > Version 1.3"],"download":""},{"url":"http:\/\/api.jquery.com\/queue\/","name":"queue","title":".queue()","type":"method","signatures":[{"added":"1.2","params":[{"name":"queueName","type":"String","optional":"optional","desc":"A string containing the name of the queue. Defaults to <code>fx<\/code>, the standard effects queue."}]}],"desc":"Show the queue of functions to be executed on the matched elements.","longdesc":"<longdesc\/>","categories":["Effects > Custom","Data","Utilities","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/queue\/","name":"queue","title":".queue()","type":"method","signatures":[{"added":"1.2","params":[{"name":"queueName","type":"String","optional":"optional","desc":"A string containing the name of the queue. Defaults to <code>fx<\/code>, the standard effects queue."},{"name":"newQueue","type":"Array","optional":"","desc":"An array of functions to replace the current queue contents."}]},{"added":"1.2","params":[{"name":"queueName","type":"String","optional":"optional","desc":"A string containing the name of the queue. Defaults to <code>fx<\/code>, the standard effects queue."},{"name":"callback( next )","type":"Function","optional":"","desc":"The new function to add to the queue, with a function to call that will dequeue the next item."}]}],"desc":"Manipulate the queue of functions to be executed on the matched elements.","longdesc":"<p>Every element can have one to many queues of functions attached to it by jQuery. In most applications, only one queue (called <code>fx<\/code>) is used. Queues allow a sequence of actions to be called on an element asynchronously, without halting program execution. The typical example of this is calling multiple animation methods on an element. For example:<\/p>\n\t\t\t\t<pre>$('#foo').slideUp().fadeIn();<\/pre>\n\t\t\t\t<p>When this statement is executed, the element begins its sliding animation immediately, but the fading transition is placed on the <code>fx<\/code> queue to be called only once the sliding transition is complete.<\/p>\n\t\t\t\t<p>The <code>.queue()<\/code> method allows us to directly manipulate this queue of functions. Calling <code>.queue()<\/code> with a callback is particularly useful; it allows us to place a new function at the end of the queue.<\/p>\n\t\t\t\t<p>This feature is similar to providing a callback function with an animation method, but does not require the callback to be given at the time the animation is performed.<\/p>\n<pre>$('#foo').slideUp();\n$('#foo').queue(function() {\n  alert('Animation complete.');\n  $(this).dequeue();\n});<\/pre>\n<p>This is equivalent to:<\/p>\n<pre>$('#foo').slideUp(function() {\n  alert('Animation complete.');\n});<\/pre>\n<p>Note that when adding a function with <code>.queue()<\/code>, we should ensure that <code>.dequeue()<\/code> is eventually called so that the next function in line executes.<\/p>\n<p><strong>As of jQuery 1.4<\/strong>, the function that's called is passed another function as the first argument. When called, this automatically dequeues the next item and keeps the queue moving. We use it as follows:<\/p>\n<pre>$(\"#test\").queue(function(next) {\n    \/\/ Do some stuff...\n    next();\n});<\/pre>","categories":["Effects > Custom","Data","Utilities","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/radio-selector\/","name":"radio","title":":radio Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all  elements of type radio.","longdesc":"<p><code>$(':radio')<\/code> is equivalent to <code>$('[type=radio]')<\/code>. As with other pseudo-class selectors (those that begin with a \":\") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector (\"*\") is implied. In other words, the bare <code>$(':radio')<\/code> is equivalent to <code>$('*:radio')<\/code>, so <code>$('input:radio')<\/code> should be used instead. <\/p>\n<p>To select a set of associated radio buttons, you might use: <code>$('input[name=gender]:radio')<\/code><\/p>","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/ready\/","name":"ready","title":".ready()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler","type":"Function","optional":"","desc":"A function to execute after the DOM is ready."}]}],"desc":"Specify a function to execute when the DOM is fully loaded.","longdesc":"\n<p>While JavaScript provides the <code>load<\/code> event for executing code when a page is rendered, this event does not get triggered until all assets such as images have been completely received. In most cases, the script can be run as soon as the DOM hierarchy has been fully constructed. The handler passed to <code>.ready()<\/code> is guaranteed to be executed after the DOM is ready, so this is usually the best place to attach all other event handlers and run other jQuery code.  When using scripts that rely on the value of CSS style properties, it's important to reference external stylesheets or embed style elements before referencing the scripts.<\/p>\n<p>In cases where code relies on loaded assets (for example, if the dimensions of an image are required), the code should be placed in a handler for the <code>load<\/code> event instead.<\/p>\n\n<blockquote><p>The <code>.ready()<\/code> method is generally incompatible with the <code>&lt;body onload=\"\"&gt;<\/code> attribute. If <code>load<\/code> must be used, either do not use <code>.ready()<\/code> or use jQuery's <code>.load()<\/code> method to attach <code>load<\/code> event handlers to the window or to more specific items, like images.\n<\/p><\/blockquote>\n<p>All three of the following syntaxes are equivalent:<\/p>\n <ul>\n   <li><code>$(document).ready(handler)<\/code><\/li>\n   <li><code>$().ready(handler)<\/code> (this is not recommended)<\/li>\n   <li><code>$(handler)<\/code><\/li>\n <\/ul>\n<p>There is also <code>$(document).bind(\"ready\", handler)<\/code>. This behaves similarly to the ready method but with one exception: If the ready event has already fired and you try to <code>.bind(\"ready\")<\/code> the bound handler will not be executed. Ready handlers bound this way are executed <em>after<\/em> any bound by the other three methods above.<\/p>\n <p>The <code>.ready()<\/code> method can only be called on a jQuery object matching the current document, so the selector can be omitted.<\/p>\n<p>The <code>.ready()<\/code> method is typically used with an anonymous function:<\/p>\n<pre>$(document).ready(function() {\n  \/\/ Handler for .ready() called.\n});<\/pre>\n<p>Which is equivalent to calling:<\/p>\n<pre>$(function() {\n \/\/ Handler for .ready() called.\n});<\/pre>\n<p>If <code>.ready()<\/code> is called after the DOM has been initialized, the new handler passed in will be executed immediately.<\/p>\n<h4>Aliasing the jQuery Namespace<\/h4>\n<p>When using another JavaScript library, we may wish to call <code><a href=\"\/jQuery.noConflict\">$.noConflict()<\/a><\/code> to avoid namespace difficulties. When this function is called, the <code>$<\/code> shortcut is no longer available, forcing us to write <code>jQuery<\/code> each time we would normally write <code>$<\/code>. However, the handler passed to the <code>.ready()<\/code> method can take an argument, which is passed the global <code>jQuery<\/code> object. This means we can rename the object within the context of our <code>.ready()<\/code> handler without affecting other code:<\/p>\n<pre>jQuery(document).ready(function($) {\n  \/\/ Code using $ as usual goes here.\n});<\/pre>\n","categories":["Events > Document Loading","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/remove\/","name":"remove","title":".remove()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"String","optional":"optional","desc":"A selector expression that filters the set of matched elements to be removed."}]}],"desc":"Remove the set of matched elements from the DOM.","longdesc":"<p>Similar to <code><a href=\"\/empty\">.empty()<\/a><\/code>, the <code>.remove()<\/code> method takes elements out of the DOM. Use <code>.remove()<\/code> when you want to remove the element itself, as well as everything inside it. In addition to the elements themselves, all bound events and jQuery data  associated with the elements are removed. To remove the elements without removing data and events, use <code><a href=\"http:\/\/api.jquery.com\/detach\/\">.detach()<\/a><\/code> instead.<\/p>\n\t\t\t\t<p>Consider the following HTML:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"hello\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"goodbye\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>We can target any element for removal:<\/p>\n\t\t\t\t<pre>$('.hello').remove();<\/pre>\n\t\t\t\t<p>This will result in a DOM structure with the <code>&lt;div&gt;<\/code> element deleted:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"goodbye\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>If we had any number of nested elements inside <code>&lt;div class=\"hello\"&gt;<\/code>, they would be removed, too. Other jQuery constructs such as data or event handlers are erased as well.<\/p>\n\t\t\t\t<p>We can also include a selector as an optional parameter. For example, we could rewrite the previous DOM removal code as follows:<\/p>\n\t\t\t\t<pre>$('div').remove('.hello');<\/pre>\n\t\t\t\t<p>This would result in the same DOM structure:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"goodbye\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>","categories":["Manipulation > DOM Removal","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/removeAttr\/","name":"removeAttr","title":".removeAttr()","type":"method","signatures":[{"added":"1.0","params":[{"name":"attributeName","type":"String","optional":"","desc":"An attribute to remove; as of version 1.7, it can be a space-separated list of attributes."}]}],"desc":"Remove an attribute from each element in the set of matched elements.","longdesc":"<p>The <code>.removeAttr()<\/code> method uses the JavaScript <code>removeAttribute()<\/code> function, but it has the advantage of being able to be called directly on a jQuery object and it accounts for different attribute naming across browsers.<\/p>\n<p><strong>Note:<\/strong> Removing an inline <code>onclick<\/code> event handler using <code>.removeAttr()<\/code> doesn't achieve the desired effect in Internet Explorer 6, 7, or 8. To avoid potential problems, use <code>.prop()<\/code> instead:<\/p>\n<pre>\n$element.prop(\"onclick\", null);\nconsole.log(\"onclick property: \", $element[0].onclick);\n<\/pre>\n","categories":["Attributes","Manipulation > General Attributes","Version > Version 1.0","Version > Version 1.4","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/removeClass\/","name":"removeClass","title":".removeClass()","type":"method","signatures":[{"added":"1.0","params":[{"name":"className","type":"String","optional":"optional","desc":"One or more space-separated classes to be removed from the class attribute of each matched element."}]},{"added":"1.4","params":[{"name":"function(index, class)","type":"Function","optional":"","desc":"A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments."}]}],"desc":"Remove a single class, multiple classes, or all classes from each element in the set of matched elements.","longdesc":"<p>If a class name is included as a parameter, then only that class will be removed from the set of matched elements. If no class names are specified in the parameter, all classes will be removed.<\/p>\n\t\t\t\t<p>More than one class may be removed at a time, separated by a space, from the set of matched elements, like so:<\/p>\n\t\t\t\t<pre>$('p').removeClass('myClass yourClass')\n<\/pre>\n\t\t\t\t<p>This method is often used with <code>.addClass()<\/code> to switch elements' classes from one to another, like so:<\/p>\n\t\t\t\t<pre>$('p').removeClass('myClass noClass').addClass('yourClass');\n<\/pre>\n\t\t\t\t<p>Here, the <code>myClass<\/code> and <code>noClass<\/code> classes are removed from all paragraphs, while <code>yourClass<\/code> is added.<\/p>\n\t\t\t\t<p>To replace all existing classes with another class, we can use <code>.attr('class', 'newClass')<\/code> instead.<\/p>\n        <p>As of jQuery 1.4, the <code>.removeClass()<\/code> method allows us to indicate the class to be removed by passing in a function.<\/p>\n        <pre>$('li:last').removeClass(function() {\n          return $(this).prev().attr('class');\n        });<\/pre>\n        <p>This example removes the class name of the penultimate <code>&lt;li&gt;<\/code> from the last <code>&lt;li&gt;<\/code>.<\/p>\n","categories":["Attributes","Manipulation > Class Attribute","CSS","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/removeData\/","name":"removeData","title":".removeData()","type":"method","signatures":[{"added":"1.2.3","params":[{"name":"name","type":"String","optional":"optional","desc":"A string naming the piece of data to delete."}]},{"added":"1.7","params":[{"name":"list","type":"Array,String","optional":"optional","desc":"An array or space-separated string naming the pieces of data to delete."}]}],"desc":"Remove a previously-stored piece of data.","longdesc":"\n                <p>The <code>.removeData()<\/code> method allows us to remove values that were previously set using <code>.data()<\/code>. When called with the name of a key, <code>.removeData()<\/code> deletes that particular value; when called with no arguments, all values are removed. Removing data from jQuery's internal <code>.data()<\/code> cache does not effect any HTML5 <code>data-<\/code> attributes in a document; use <code>.removeAttr()<\/code> to remove those.<\/p>\n<p>When using <code>.removeData(\"name\")<\/code>, jQuery will attempt to locate a <code>data-<\/code> attribute on the element if no property by that name is in the internal data cache. To avoid a re-query of the <code>data-<\/code> attribute, set the name to a value of either <code>null<\/code> or <code>undefined<\/code> (e.g. <code>.data(\"name\", undefined)<\/code>) rather than using <code>.removeData()<\/code>.<\/p>\n<p><strong>As of jQuery 1.7<\/strong>, when called with an array of keys or a string of space-separated keys, <code>.removeData()<\/code> deletes the value of each key in that array or string.<\/p>\n<p><strong>As of jQuery 1.4.3<\/strong>, calling <code>.removeData()<\/code> will cause the value of the property being removed to revert to the value of the data attribute of the same name in the DOM, rather than being set to <code>undefined<\/code>.<\/p>\n              ","categories":["Data","Miscellaneous > Data Storage","Version > Version 1.2.3","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/removeProp\/","name":"removeProp","title":".removeProp()","type":"method","signatures":[{"added":"1.6","params":[{"name":"propertyName","type":"String","optional":"","desc":"The name of the property to set."}]}],"desc":"Remove a property for the set of matched elements.","longdesc":"<p>The <code>.removeProp()<\/code> method removes properties set by the <code><a href=\"http:\/\/api.jquery.com\/prop\">.prop()<\/a><\/code> method.<\/p>\n<p>With some built-in properties of a DOM element or <code>window<\/code> object, browsers may generate an error if an attempt is made to remove the property. jQuery first assigns the value <code>undefined<\/code> to the property and ignores any error the browser generates. In general, it is only necessary to remove custom properties that have been set on an object, and not built-in (native) properties.<\/p>\n<p><strong>Note:<\/strong> Do not use this method to remove native properties such as checked, disabled, or selected. This will remove the property completely and, once removed, cannot be added again to element. Use <code><a href=\"http:\/\/api.jquery.com\/prop\">.prop()<\/a><\/code> to set these properties to <code>false<\/code> instead.<\/p>\n","categories":["Attributes","Manipulation > General Attributes","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/replaceAll\/","name":"replaceAll","title":".replaceAll()","type":"method","signatures":[{"added":"1.2","params":[{"name":"target","type":"Selector","optional":"","desc":"A selector expression indicating which element(s) to replace."}]}],"desc":"Replace each target element with the set of matched elements.","longdesc":"<p>The <code>.replaceAll()<\/code> method is corollary to <code><a href=\"\/replaceWith\">.replaceWith()<\/a><\/code>, but with the source and target reversed. Consider this DOM structure:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner first\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner second\"&gt;And&lt;\/div&gt;\n  &lt;div class=\"inner third\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>We can create an element, then replace other elements with it:<\/p>\n\t\t\t\t<pre>$('&lt;h2&gt;New heading&lt;\/h2&gt;').replaceAll('.inner');<\/pre>\n\t\t\t\t<p>This causes all of them to be replaced:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;New heading&lt;\/h2&gt;\n  &lt;h2&gt;New heading&lt;\/h2&gt;\n  &lt;h2&gt;New heading&lt;\/h2&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>Or, we could select an element to use as the replacement:<\/p>\n\t\t\t\t<pre>$('.first').replaceAll('.third');<\/pre>\n\t\t\t\t<p>This results in the DOM structure:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner second\"&gt;And&lt;\/div&gt;\n  &lt;div class=\"inner first\"&gt;Hello&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>From this example, we can see that the selected element replaces the target by being moved from its old location, not by being cloned.<\/p>","categories":["Manipulation > DOM Replacement","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/replaceWith\/","name":"replaceWith","title":".replaceWith()","type":"method","signatures":[{"added":"1.2","params":[{"name":"newContent","type":"String, Element, jQuery","optional":"","desc":"The content to insert. May be an HTML string, DOM element, or jQuery object."}]},{"added":"1.4","params":[{"name":"function","type":"Function","optional":"","desc":"A function that returns content with which to replace the set of matched elements."}]}],"desc":"Replace each element in the set of matched elements with the provided new content.","longdesc":"<p>The <code>.replaceWith()<\/code> method removes content from the DOM and inserts new content in its place with a single call. Consider this DOM structure:<\/p>\n    <pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner first\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner second\"&gt;And&lt;\/div&gt;\n  &lt;div class=\"inner third\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n    <p>The second inner <code>&lt;div&gt;<\/code> could be replaced with the specified HTML:<\/p>\n    <pre>$('div.second').replaceWith('&lt;h2&gt;New heading&lt;\/h2&gt;');<\/pre>\n    <p>This results in the structure:<\/p>\n    <pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner first\"&gt;Hello&lt;\/div&gt;\n  &lt;h2&gt;New heading&lt;\/h2&gt;\n  &lt;div class=\"inner third\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n    <p><em>All<\/em> inner <code>&lt;div&gt;<\/code> elements could be targeted at once:<\/p>\n    <pre>$('div.inner').replaceWith('&lt;h2&gt;New heading&lt;\/h2&gt;');<\/pre>\n    <p>This causes all of them to be replaced:<\/p>\n    <pre>&lt;div class=\"container\"&gt;\n  &lt;h2&gt;New heading&lt;\/h2&gt;\n  &lt;h2&gt;New heading&lt;\/h2&gt;\n  &lt;h2&gt;New heading&lt;\/h2&gt;\n&lt;\/div&gt;<\/pre>\n    <p>An element could also be selected as the replacement:<\/p>\n    <pre>$('div.third').replaceWith($('.first'));<\/pre>\n    <p>This results in the DOM structure:<\/p>\n    <pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner second\"&gt;And&lt;\/div&gt;\n  &lt;div class=\"inner first\"&gt;Hello&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n    <p>This example demonstrates that the selected element replaces the target by being moved from its old location, not by being cloned.<\/p>\n    <p>The <code>.replaceWith()<\/code> method, like most jQuery methods, returns the jQuery object so that other methods can be chained onto it. However, it must be noted that the <em>original<\/em> jQuery object is returned. This object refers to the element that has been removed from the DOM, not the new element that has replaced it.<\/p>\n<p>As of jQuery 1.4, <code>.replaceWith()<\/code> can also work on disconnected DOM nodes. For example, with the following code, <code>.replaceWith()<\/code> returns a jQuery set containing only a paragraph.:<\/p>\n<pre>$(\"&lt;div\/&gt;\").replaceWith(\"&lt;p&gt;&lt;\/p&gt;\");<\/pre>\n<p>The <code>.replaceWith()<\/code> method can also take a function as its argument:<\/p>\n<pre>$('div.container').replaceWith(function() {\n  return $(this).contents();\n});<\/pre>\n<p>This results in <code>&lt;div class=\"container\"&gt;<\/code> being replaced by its three child <code>&lt;div&gt;<\/code>s. The return value of the function may be an HTML string, DOM element, or jQuery object.<\/p>\n","categories":["Manipulation > DOM Replacement","Version > Version 1.2","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/reset-selector\/","name":"reset","title":":reset Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements of type reset.","longdesc":"<p><code>:reset<\/code> is equivalent to <code>[type=\"reset\"]<\/code><\/p>","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/resize\/","name":"resize","title":".resize()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"resize\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('resize', handler)<\/code> in the first and second variations, and <code>.trigger('resize')<\/code> in the third.<\/p>\n<p>The <code>resize<\/code> event is sent to the <code>window<\/code> element when the size of the browser window changes:<\/p>\n<pre>$(window).resize(function() {\n  $('#log').append('&lt;div&gt;Handler for .resize() called.&lt;\/div&gt;');\n});\n<\/pre>\n<p>Now whenever the browser window's size is changed, the message is appended to &lt;div id=\"log\"&gt; one or more times, depending on the browser.<\/p>\n<p>Code in a <code>resize<\/code> handler should never rely on the number of times the handler is called. Depending on implementation, <code>resize<\/code> events can be sent continuously as the resizing is in progress (the typical behavior in Internet Explorer and WebKit-based browsers such as Safari and Chrome), or only once at the end of the resize operation (the typical behavior in some other browsers such as Opera).<\/p>\n","categories":["Events > Browser Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/scroll\/","name":"scroll","title":".scroll()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"scroll\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('scroll', handler)<\/code> in the first and second variations, and <code>.trigger('scroll')<\/code> in the third.<\/p>\n<p>The <code>scroll<\/code> event is sent to an element when the user scrolls to a different place in the element. It applies to <code>window<\/code> objects, but also to scrollable frames and elements with the <code>overflow <\/code>CSS property set to <code>scroll<\/code> (or <code>auto<\/code> when the element's explicit height or width is less than the height or width of its contents).<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;div id=\"target\" style=\"overflow: scroll; width: 200px; height: 100px;\"&gt;\n  Lorem ipsum dolor sit amet, consectetur adipisicing elit,\n  sed do eiusmod tempor incididunt ut labore et dolore magna\n  aliqua. Ut enim ad minim veniam, quis nostrud exercitation\n  ullamco laboris nisi ut aliquip ex ea commodo consequat.\n  Duis aute irure dolor in reprehenderit in voluptate velit\n  esse cillum dolore eu fugiat nulla pariatur. Excepteur\n  sint occaecat cupidatat non proident, sunt in culpa qui\n  officia deserunt mollit anim id est laborum.\n&lt;\/div&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;\n&lt;div id=\"log\"&gt;&lt;\/div&gt;<\/pre>\n<p>The style definition is present to make the target element small enough to be scrollable:<\/p>\n \n<p class=\"image\"><img src=\"\/images\/0042_05_11.png\" alt=\"\"\/>\n<\/p>\n<p>The <code>scroll<\/code> event handler can be bound to this element:<\/p>\n<pre>$('#target').scroll(function() {\n  $('#log').append('&lt;div&gt;Handler for .scroll() called.&lt;\/div&gt;');\n});<\/pre>\n<p>Now when the user scrolls the text up or down, one or more messages are appended to <code>&lt;div id=\"log\"&gt;&lt;\/div&gt;<\/code>:<\/p>\n<p><span class=\"output\">Handler for .scroll() called.<\/span><\/p>\n<p>To trigger the event manually, apply <code>.scroll()<\/code> without an argument:<\/p>\n<pre>$('#other').click(function() {\n  $('#target').scroll();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also append the message.<\/p>\n<p>A <code>scroll<\/code> event is sent whenever the element's scroll position changes, regardless of the cause. A mouse click or drag on the scroll bar, dragging inside the element, pressing the arrow keys, or using the mouse's scroll wheel could cause this event.<\/p>\n","categories":["Events > Browser Events","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/scrollLeft\/","name":"scrollLeft","title":".scrollLeft()","type":"method","signatures":[{"added":"1.2.6"}],"desc":"Get the current horizontal position of the scroll bar for the first element in the set of matched elements.","longdesc":"<p>The horizontal scroll position is the same as the number of pixels that are hidden from view to the left of the scrollable area. If the scroll bar is at the very left, or if the element is not scrollable, this number will be <code>0<\/code>.<\/p>\n<blockquote><p><strong>Note:<\/strong> <code>.scrollLeft()<\/code>, when called directly or animated as a property using <code>.animate()<\/code>, will not work if the element it is being applied to is hidden.<\/p><\/blockquote>\n  ","categories":["CSS","Offset","Manipulation > Style Properties","Version > Version 1.2.6"],"download":""},{"url":"http:\/\/api.jquery.com\/scrollLeft\/","name":"scrollLeft","title":".scrollLeft()","type":"method","signatures":[{"added":"1.2.6","params":[{"name":"value","type":"Number","optional":"","desc":"An integer indicating the new position to set the scroll bar to."}]}],"desc":"Set the current horizontal position of the scroll bar for each of the set of matched elements.","longdesc":"<p>The horizontal scroll position is the same as the number of pixels that are hidden from view above the scrollable area. Setting the <code>scrollLeft<\/code> positions the horizontal scroll of each matched element.<\/p>","categories":["CSS","Offset","Manipulation > Style Properties","Version > Version 1.2.6"],"download":""},{"url":"http:\/\/api.jquery.com\/scrollTop\/","name":"scrollTop","title":".scrollTop()","type":"method","signatures":[{"added":"1.2.6"}],"desc":"Get the current vertical position of the scroll bar for the first element in the set of matched elements.","longdesc":"<p>The vertical scroll position is the same as the number of pixels that are hidden from view above the scrollable area. If the scroll bar is at the very top, or if the element is not scrollable, this number will be <code>0<\/code>.<\/p>","categories":["CSS","Offset","Manipulation > Style Properties","Version > Version 1.2.6"],"download":""},{"url":"http:\/\/api.jquery.com\/scrollTop\/","name":"scrollTop","title":".scrollTop()","type":"method","signatures":[{"added":"1.2.6","params":[{"name":"value","type":"Number","optional":"","desc":"An integer indicating the new position to set the scroll bar to."}]}],"desc":"Set the current vertical position of the scroll bar for each of the set of matched elements.","longdesc":"<p>The vertical scroll position is the same as the number of pixels that are hidden from view above the scrollable area. Setting the <code>scrollTop<\/code> positions the vertical scroll of each matched element.<\/p>","categories":["CSS","Offset","Manipulation > Style Properties","Version > Version 1.2.6"],"download":""},{"url":"http:\/\/api.jquery.com\/select\/","name":"select","title":".select()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"select\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('select', handler)<\/code> in the first two variations, and <code>.trigger('select')<\/code> in the third.<\/p>\n<p>The <code>select<\/code> event is sent to an element when the user makes a text selection inside it. This event is limited to <code>&lt;input type=\"text\"&gt;<\/code> fields and <code>&lt;textarea&gt;<\/code> boxes.<\/p>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;form&gt;\n  &lt;input id=\"target\" type=\"text\" value=\"Hello there\" \/&gt;\n&lt;\/form&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;<\/pre>\n<p>The event handler can be bound to the text input:<\/p>\n<pre>$('#target').select(function() {\n  alert('Handler for .select() called.');\n});<\/pre>\n<p>Now when any portion of the text is selected, the alert is displayed. Merely setting the location of the insertion point will not trigger the event. To trigger the event manually, apply <code>.select()<\/code> without an argument:<\/p>\n<pre>$('#other').click(function() {\n  $('#target').select();\n});<\/pre>\n<p>After this code executes, clicks on the Trigger button will also alert the message:<\/p>\n<p><span class=\"output\">Handler for .select() called.<\/span><\/p>\n<p>In addition, the default <code>select<\/code> action on the field will be fired, so the entire text field will be selected.<\/p>\n<blockquote><p>The method for retrieving the current selected text differs from one browser to another. A number of jQuery plug-ins offer cross-platform solutions.<\/p><\/blockquote>\n","categories":["Events > Form Events","Forms","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/selected-selector\/","name":"selected","title":":selected Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements that are selected.","longdesc":"<p>The <code>:selected<\/code> selector works for <code>&lt;option&gt;<\/code> elements. It does not work for checkboxes or radio inputs; use <code>:checked<\/code> for them.<\/p>","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/serialize\/","name":"serialize","title":".serialize()","type":"method","signatures":[{"added":"1.0"}],"desc":"Encode a set of form elements as a string for submission.","longdesc":"<p>The <code>.serialize()<\/code> method creates a text string in standard URL-encoded notation. It operates on a jQuery object representing a set of form elements. The form elements can be of several types:<\/p>\n\t\t\t\t<pre>&lt;form&gt;\n  &lt;div&gt;&lt;input type=\"text\" name=\"a\" value=\"1\" id=\"a\" \/&gt;&lt;\/div&gt;\n  &lt;div&gt;&lt;input type=\"text\" name=\"b\" value=\"2\" id=\"b\" \/&gt;&lt;\/div&gt;\n  &lt;div&gt;&lt;input type=\"hidden\" name=\"c\" value=\"3\" id=\"c\" \/&gt;&lt;\/div&gt;\n  &lt;div&gt;\n    &lt;textarea name=\"d\" rows=\"8\" cols=\"40\"&gt;4&lt;\/textarea&gt;\n  &lt;\/div&gt;\n  &lt;div&gt;&lt;select name=\"e\"&gt;\n    &lt;option value=\"5\" selected=\"selected\"&gt;5&lt;\/option&gt;\n    &lt;option value=\"6\"&gt;6&lt;\/option&gt;\n    &lt;option value=\"7\"&gt;7&lt;\/option&gt;\n  &lt;\/select&gt;&lt;\/div&gt;\n  &lt;div&gt;\n    &lt;input type=\"checkbox\" name=\"f\" value=\"8\" id=\"f\" \/&gt;\n  &lt;\/div&gt;\n  &lt;div&gt;\n    &lt;input type=\"submit\" name=\"g\" value=\"Submit\" id=\"g\" \/&gt;\n  &lt;\/div&gt;\n&lt;\/form&gt;<\/pre>\n\t\t\t\t<p>The <code>.serialize()<\/code> method can act on a jQuery object that has selected individual form elements, such as <code>&lt;input&gt;<\/code>, <code>&lt;textarea&gt;<\/code>, and <code>&lt;select&gt;<\/code>. However, it is typically easier to select the <code>&lt;form&gt;<\/code> tag itself for serialization:<\/p>\n\t\t\t\t<pre>$('form').submit(function() {\n  alert($(this).serialize());\n  return false;\n});<\/pre>\n\t\t\t\t<p>This produces a standard-looking query string:<\/p>\n\t\t\t\t<pre>a=1&amp;b=2&amp;c=3&amp;d=4&amp;e=5<\/pre>\n<p><strong>Warning:<\/strong> selecting both the form and its children will cause duplicates in the serialized string.<\/p>\n<p>Note: Only <a href=\"http:\/\/www.w3.org\/TR\/html401\/interact\/forms.html#h-17.13.2\">\"successful controls\"<\/a> are serialized to the string. No submit button value is serialized since the form was not submitted using a button. For a form element's value to be included in the serialized string, the element must have a <code>name<\/code> attribute. Values from checkboxes and radio buttons (<code>input<\/code>s of type \"radio\" or \"checkbox\") are included only if they are checked. Data from file select elements is not serialized.<\/p>\n","categories":["Forms","Ajax > Helper Functions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/serializeArray\/","name":"serializeArray","title":".serializeArray()","type":"method","signatures":[{"added":"1.2"}],"desc":"Encode a set of form elements as an array of names and values.","longdesc":"<p>The <code>.serializeArray()<\/code> method creates a JavaScript array of objects, ready to be encoded as a JSON string. It operates on a jQuery object representing a set of form elements. The form elements can be of several types:<\/p>\n\t\t\t\t<pre>&lt;form&gt;\n  &lt;div&gt;&lt;input type=\"text\" name=\"a\" value=\"1\" id=\"a\" \/&gt;&lt;\/div&gt;\n  &lt;div&gt;&lt;input type=\"text\" name=\"b\" value=\"2\" id=\"b\" \/&gt;&lt;\/div&gt;\n  &lt;div&gt;&lt;input type=\"hidden\" name=\"c\" value=\"3\" id=\"c\" \/&gt;&lt;\/div&gt;\n  &lt;div&gt;\n    &lt;textarea name=\"d\" rows=\"8\" cols=\"40\"&gt;4&lt;\/textarea&gt;\n  &lt;\/div&gt;\n  &lt;div&gt;&lt;select name=\"e\"&gt;\n    &lt;option value=\"5\" selected=\"selected\"&gt;5&lt;\/option&gt;\n    &lt;option value=\"6\"&gt;6&lt;\/option&gt;\n    &lt;option value=\"7\"&gt;7&lt;\/option&gt;\n  &lt;\/select&gt;&lt;\/div&gt;\n  &lt;div&gt;\n    &lt;input type=\"checkbox\" name=\"f\" value=\"8\" id=\"f\" \/&gt;\n  &lt;\/div&gt;\n  &lt;div&gt;\n    &lt;input type=\"submit\" name=\"g\" value=\"Submit\" id=\"g\" \/&gt;\n  &lt;\/div&gt;\n&lt;\/form&gt;<\/pre>\n\t\t\t\t<p>The <code>.serializeArray()<\/code> method uses the standard W3C rules for <a href=\"http:\/\/www.w3.org\/TR\/html401\/interact\/forms.html#h-17.13.2\">successful controls<\/a> to determine which elements it should include; in particular the element cannot be disabled and must contain a <code>name<\/code> attribute. No submit button value is serialized since the form was not submitted using a button. Data from file select elements is not serialized.<\/p>\n<p>This method can act on a jQuery object that has selected individual form elements, such as <code>&lt;input&gt;<\/code>, <code>&lt;textarea&gt;<\/code>, and <code>&lt;select&gt;<\/code>. However, it is typically easier to select the <code>&lt;form&gt;<\/code> tag itself for serialization:<\/p>\n\t\t\t\t<pre>$('form').submit(function() {\n  console.log($(this).serializeArray());\n  return false;\n});<\/pre>\n\t\t\t\t<p>This produces the following data structure (provided that the browser supports <code>console.log<\/code>):<\/p>\n\t\t\t\t<pre>[\n  {\n    name: \"a\",\n    value: \"1\"\n  },\n  {\n    name: \"b\",\n    value: \"2\"\n  },\n  {\n    name: \"c\",\n    value: \"3\"\n  },\n  {\n    name: \"d\",\n    value: \"4\"\n  },\n  {\n    name: \"e\",\n    value: \"5\"\n  }\n]<\/pre>","categories":["Forms","Ajax > Helper Functions","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/show\/","name":"show","title":".show()","type":"method","signatures":[{"added":"1.0"},{"added":"1.0","params":[{"name":"duration","type":"String,Number","optional":"","desc":"A string or number determining how long the animation will run."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.4.3","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]}],"desc":"Display the matched elements.","longdesc":"\n<p>With no parameters, the <code>.show()<\/code> method is the simplest way to display an element:\n<\/p>\n<pre>$('.target').show();\n<\/pre>\n<p>The matched elements will be revealed immediately, with no animation. This is roughly equivalent to calling <code>.css('display', 'block')<\/code>, except that the <code>display<\/code> property is restored to whatever it was initially. If an element has a <code>display<\/code> value of <code>inline<\/code>, then is hidden and shown, it will once again be displayed <code>inline<\/code>.<\/p>\n<p><strong>Note: <\/strong> If using !important in your styles, such as\n<code>display: none !important<\/code>,\nit is necessary to override the style using <code>.css('display', 'block !important')<\/code> should you wish for <code>.show()<\/code> to function correctly.<\/p>\n<p>When a duration is provided, <code>.show()<\/code> becomes an animation method. The <code>.show()<\/code> method animates the width, height, and opacity of the matched elements simultaneously.<\/p>\n<p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively.<\/p>\n    <p>As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing<\/code>, and one that progresses at a constant pace, called <code>linear<\/code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http:\/\/jqueryui.com\">jQuery UI suite<\/a>.<\/p>\n<p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n<p>We can animate any element, such as a simple image:<\/p>\n<pre>&lt;div id=\"clickme\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \/&gt;\nWith the element initially hidden, we can show it slowly:\n$('#clickme').click(function() {\n  $('#book').show('slow', function() {\n    \/\/ Animation complete.\n  });\n});<\/pre>\n<p class=\"image four-across\">\n  <img src=\"\/images\/0042_06_01.png\" alt=\"\"\/>\n  <img src=\"\/images\/0042_06_02.png\" alt=\"\"\/>\n  <img src=\"\/images\/0042_06_03.png\" alt=\"\"\/>\n  <img src=\"\/images\/0042_06_04.png\" alt=\"\"\/>\n<\/p>\n\n","categories":["Effects > Basics","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/siblings\/","name":"siblings","title":".siblings()","type":"method","signatures":[{"added":"1.0","params":[{"name":"selector","type":"Selector","optional":"optional","desc":"A string containing a selector expression to match elements against."}]}],"desc":"Get the siblings of each element in the set of matched elements, optionally filtered by a selector.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.siblings()<\/code> method allows us to search through the siblings of these elements in the DOM tree and construct a new jQuery object from the matching elements.<\/p>\n<p>The method optionally accepts a selector expression of the same type that we can pass to the <code>$()<\/code> function. If the selector is supplied, the elements will be filtered by testing whether they match it.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n&lt;ul&gt;\n   &lt;li&gt;list item 1&lt;\/li&gt;\n   &lt;li&gt;list item 2&lt;\/li&gt;\n   &lt;li class=\"third-item\"&gt;list item 3&lt;\/li&gt;\n   &lt;li&gt;list item 4&lt;\/li&gt;\n   &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>If we begin at the third item, we can find its siblings:<\/p>\n<pre>$('li.third-item').siblings().css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background behind items 1, 2, 4, and 5. Since we do not supply a selector expression, all of the siblings are part of the object. If we had supplied one, only the matching items among these four would be included.<\/p>\n<p>The original element is not included among the siblings, which is important to remember when we wish to find all elements at a particular level of the DOM tree.<\/p>","categories":["Traversing > Tree Traversal","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/size\/","name":"size","title":".size()","type":"method","signatures":[{"added":"1.0"}],"desc":"Return the number of elements in the jQuery object.","longdesc":"\n<p>The <code>.size()<\/code> method is functionally equivalent to the <code><a href=\"http:\/\/api.jquery.com\/length\/\">.length<\/a><\/code> property; however, <strong>the <code>.length<\/code> property is preferred<\/strong> because it does not have the overhead of a function call.<\/p>\n<p>Given a simple unordered list on the page:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li&gt;foo&lt;\/li&gt;\n  &lt;li&gt;bar&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>Both <code>.size()<\/code> and <code>.length<\/code> identify the number of items:<\/p>\n<pre>alert( \"Size: \" + $(\"li\").size() );\nalert( \"Size: \" + $(\"li\").length );<\/pre>\n<p>This results in two alerts:<\/p>\n<p><span class=\"output\">Size: 2<\/span><\/p>\n<p><span class=\"output\">Size: 2<\/span><\/p>\n","categories":["Miscellaneous > DOM Element Methods","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/slice\/","name":"slice","title":".slice()","type":"method","signatures":[{"added":"1.1.4","params":[{"name":"start","type":"Integer","optional":"","desc":"An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set."},{"name":"end","type":"Integer","optional":"optional","desc":"An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set."}]}],"desc":"Reduce the set of matched elements to a subset specified by a range of indices.","longdesc":"<p>Given a jQuery object that represents a set of DOM elements, the <code>.slice()<\/code> method constructs a new jQuery object from a subset of the matching elements. The supplied <code>start<\/code> index identifies the position of one of the elements in the set; if <code>end<\/code> is omitted, all elements after this one will be included in the result.<\/p>\n<p>Consider a page with a simple list on it:<\/p>\n<pre>\n&lt;ul&gt;\n  &lt;li&gt;list item 1&lt;\/li&gt;\n  &lt;li&gt;list item 2&lt;\/li&gt;\n  &lt;li&gt;list item 3&lt;\/li&gt;\n  &lt;li&gt;list item 4&lt;\/li&gt;\n  &lt;li&gt;list item 5&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n<p>We can apply this method to the set of list items:<\/p>\n<pre>$('li').slice(2).css('background-color', 'red');<\/pre>\n<p>The result of this call is a red background for items 3, 4, and 5. Note that the supplied index is zero-based, and refers to the position of elements within the jQuery object, not within the DOM tree.<\/p>\n<p>The end parameter allows us to limit the selected range even further. For example:<\/p>\n<pre>$('li').slice(2, 4).css('background-color', 'red');<\/pre>\n<p>Now only items 3 and 4 are selected. The index is once again zero-based; the range extends up to but not including the specified index.<\/p>\n<h4>Negative Indices<\/h4>\n<p>The jQuery <code>.slice()<\/code> method is patterned after the JavaScript .slice() method for arrays. One of the features that it mimics is the ability for negative numbers to be passed as either the <code>start<\/code> or <code>end<\/code> parameter. If a negative number is provided, this indicates a position starting from the end of the set, rather than the beginning. For example:<\/p>\n<pre>$('li').slice(-2, -1).css('background-color', 'red');<\/pre>\n<p>This time only list item 4 is turned red, since it is the only item in the range between two from the end (<code>-2<\/code>) and one from the end (<code>-1<\/code>).<\/p>","categories":["Traversing > Filtering","Version > Version 1.1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/slideDown\/","name":"slideDown","title":".slideDown()","type":"method","signatures":[{"added":"1.0","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.4.3","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]}],"desc":"Display the matched elements with a sliding motion.","longdesc":"\n<p>The <code>.slideDown()<\/code> method animates the height of the matched elements. This causes lower parts of the page to slide down, making way for the revealed items.<\/p>\n<p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively. If any other string is supplied, or if the <code>duration<\/code> parameter is omitted, the default duration of  <code>400<\/code> milliseconds is used.<\/p>\n<p>We can animate any element, such as a simple image:<\/p>\n<pre>&lt;div id=\"clickme\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \/&gt;<\/pre>\n<p>With the element initially hidden, we can show it slowly:<\/p>\n<pre>$('#clickme').click(function() {\n  $('#book').slideDown('slow', function() {\n    \/\/ Animation complete.\n  });\n});<\/pre>\n<p class=\"image four-across\"> \n<img src=\"\/images\/0042_06_17.png\" alt=\"\"\/>\n<img src=\"\/images\/0042_06_18.png\" alt=\"\"\/>\n<img src=\"\/images\/0042_06_19.png\" alt=\"\"\/>\n<img src=\"\/images\/0042_06_20.png\" alt=\"\"\/>\n<\/p>\n    <h4 id=\"easing\">Easing<\/h4>\n    <p><strong>As of jQuery 1.4.3<\/strong>, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing<\/code>, and one that progresses at a constant pace, called <code>linear<\/code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http:\/\/jqueryui.com\">jQuery UI suite<\/a>.<\/p>\n    <h4 id=\"callback-function\">Callback Function<\/h4>\n<p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n<p><strong>As of jQuery 1.6<\/strong>, the <code><a href=\"http:\/\/api.jquery.com\/promise\/\">.promise()<\/a><\/code> method can be used in conjunction with the <code><a href=\"http:\/\/api.jquery.com\/deferred.done\/\">deferred.done()<\/a><\/code> method to execute a single callback for the animation as a whole when <em>all<\/em> matching elements have completed their animations ( See the <a href=\"http:\/\/api.jquery.com\/promise\/#example-1\">example for .promise()<\/a> ).  <\/p>\n","categories":["Effects > Sliding","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/slideToggle\/","name":"slideToggle","title":".slideToggle()","type":"method","signatures":[{"added":"1.0","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.4.3","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]}],"desc":"Display or hide the matched elements with a sliding motion.","longdesc":"\n  <p>The <code>.slideToggle()<\/code> method animates the height of the matched elements. This causes lower parts of the page to slide up or down, appearing to reveal or conceal the items. If the element is initially displayed, it will be hidden; if hidden, it will be shown. The <code>display<\/code> property is saved and restored as needed. If an element has a <code>display<\/code> value of <code>inline<\/code>, then is hidden and shown, it will once again be displayed <code>inline<\/code>. When the height reaches 0 after a hiding animation, the <code>display<\/code> style property is set to <code>none<\/code> to ensure that the element no longer affects the layout of the page.<\/p>\n  <p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively.<\/p>\n  <p>We can animate any element, such as a simple image:<\/p>\n<pre>&lt;div id=\"clickme\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \/&gt;<\/pre>\n  <p>We will cause <code>.slideToggle()<\/code> to be called when another element is clicked:<\/p>\n<pre>$('#clickme').click(function() {\n  $('#book').slideToggle('slow', function() {\n    \/\/ Animation complete.\n  });\n});\n<\/pre>\n  <p>With the element initially shown, we can hide it slowly with the first click:<\/p>\n  <p class=\"image four-across\"> \n    <img src=\"\/images\/0042_06_25.png\" alt=\"\"\/>\n    <img src=\"\/images\/0042_06_26.png\" alt=\"\"\/>\n    <img src=\"\/images\/0042_06_27.png\" alt=\"\"\/>\n    <img src=\"\/images\/0042_06_28.png\" alt=\"\"\/>\n  <\/p>\n  <p>A second click will show the element once again:<\/p>\n\n  <p class=\"image four-across\"> \n    <img src=\"\/images\/0042_06_29.png\" alt=\"\"\/>\n    <img src=\"\/images\/0042_06_30.png\" alt=\"\"\/>\n    <img src=\"\/images\/0042_06_31.png\" alt=\"\"\/>\n    <img src=\"\/images\/0042_06_32.png\" alt=\"\"\/>\n  <\/p>\n    <h4 id=\"easing\">Easing<\/h4>\n    <p><strong>As of jQuery 1.4.3<\/strong>, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing<\/code>, and one that progresses at a constant pace, called <code>linear<\/code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http:\/\/jqueryui.com\">jQuery UI suite<\/a>.<\/p>\n    <h4 id=\"callback-function\">Callback Function<\/h4>\n  <p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n  <p><strong>As of jQuery 1.6<\/strong>, the <code><a href=\"http:\/\/api.jquery.com\/promise\/\">.promise()<\/a><\/code> method can be used in conjunction with the <code><a href=\"http:\/\/api.jquery.com\/deferred.done\/\">deferred.done()<\/a><\/code> method to execute a single callback for the animation as a whole when <em>all<\/em> matching elements have completed their animations ( See the <a href=\"http:\/\/api.jquery.com\/promise\/#example-1\">example for .promise()<\/a> ).  <\/p>\n  ","categories":["Effects > Sliding","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/slideUp\/","name":"slideUp","title":".slideUp()","type":"method","signatures":[{"added":"1.0","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.4.3","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]}],"desc":"Hide the matched elements with a sliding motion.","longdesc":"\n<p>The <code>.slideUp()<\/code> method animates the height of the matched elements. This causes lower parts of the page to slide up, appearing to conceal the items. Once the height reaches 0 (or, if set, to whatever the CSS min-height property is), the <code>display<\/code> style property is set to <code>none<\/code> to ensure that the element no longer affects the layout of the page.<\/p>\n  <p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively. If any other string is supplied, or if the <code>duration<\/code> parameter is omitted, the default duration of  <code>400<\/code> milliseconds is used.<\/p>\n  <p>We can animate any element, such as a simple image:<\/p>\n<pre>&lt;div id=\"clickme\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \/&gt;<\/pre>\n  <p>With the element initially shown, we can hide it slowly:<\/p>\n<pre>$('#clickme').click(function() {\n  $('#book').slideUp('slow', function() {\n    \/\/ Animation complete.\n  });\n});\n  <\/pre>\n  <p class=\"image four-across\"> \n  <img src=\"\/images\/0042_06_21.png\" alt=\"\"\/>\n  <img src=\"\/images\/0042_06_22.png\" alt=\"\"\/>\n  <img src=\"\/images\/0042_06_23.png\" alt=\"\"\/> \n  <img src=\"\/images\/0042_06_24.png\" alt=\"\"\/>\n  <\/p>\n    <h4 id=\"easing\">Easing<\/h4>\n    <p><strong>As of jQuery 1.4.3<\/strong>, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing<\/code>, and one that progresses at a constant pace, called <code>linear<\/code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http:\/\/jqueryui.com\">jQuery UI suite<\/a>.<\/p>\n    <h4 id=\"callback-function\">Callback Function<\/h4>\n  <p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n<p><strong>As of jQuery 1.6<\/strong>, the <code><a href=\"http:\/\/api.jquery.com\/promise\/\">.promise()<\/a><\/code> method can be used in conjunction with the <code><a href=\"http:\/\/api.jquery.com\/deferred.done\/\">deferred.done()<\/a><\/code> method to execute a single callback for the animation as a whole when <em>all<\/em> matching elements have completed their animations ( See the <a href=\"http:\/\/api.jquery.com\/promise\/#example-1\">example for .promise()<\/a> ).  <\/p>\n  ","categories":["Effects > Sliding","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/stop\/","name":"stop","title":".stop()","type":"method","signatures":[{"added":"1.2","params":[{"name":"clearQueue","type":"Boolean","optional":"optional","desc":"A Boolean indicating whether to remove queued animation as well. Defaults to <code>false<\/code>."},{"name":"jumpToEnd","type":"Boolean","optional":"optional","desc":"A Boolean indicating whether to complete the current animation immediately. Defaults to <code>false<\/code>."}]},{"added":"1.7","params":[{"name":"queue","type":"String","optional":"optional","desc":"The name of the queue in which to stop animations."},{"name":"clearQueue","type":"Boolean","optional":"optional","desc":"A Boolean indicating whether to remove queued animation as well. Defaults to <code>false<\/code>."},{"name":"jumpToEnd","type":"Boolean","optional":"optional","desc":"A Boolean indicating whether to complete the current animation immediately. Defaults to <code>false<\/code>."}]}],"desc":"Stop the currently-running animation on the matched elements.","longdesc":"\n  <p>When <code>.stop()<\/code> is called on an element, the currently-running animation (if any) is immediately stopped. If, for instance, an element is being hidden with <code>.slideUp()<\/code> when <code>.stop()<\/code> is called, the element will now still be displayed, but will be a fraction of its previous height. Callback functions are not called.<\/p>\n<p>If more than one animation method is called on the same element, the later animations are placed in the effects queue for the element. These animations will not begin until the first one completes. When <code>.stop()<\/code> is called, the next animation in the queue begins immediately. If the <code>clearQueue<\/code> parameter is provided with a value of <code>true<\/code>, then the rest of the animations in the queue are removed and never run.<\/p>\n<p>If the <code>jumpToEnd<\/code> argument is provided with a value of <code>true<\/code>, the current animation stops, but the element is immediately given its target values for each CSS property. In our above <code>.slideUp()<\/code> example, the element would be immediately hidden. The callback function is then immediately called, if provided.<\/p>\n<p><strong>As of jQuery 1.7<\/strong>, if the first argument is provided as a string, only the animations in the queue represented by that string will be stopped.<\/p>\n<p>The usefulness of the <code>.stop()<\/code> method is evident when we need to animate an element on <code>mouseenter<\/code> and <code>mouseleave<\/code>:<\/p>\n<pre>&lt;div id=\"hoverme\"&gt;\n  Hover me\n  &lt;img id=\"hoverme\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \/&gt;\n&lt;\/div&gt;<\/pre>\n<p>We can create a nice fade effect without the common problem of multiple queued animations by adding <code>.stop(true, true)<\/code> to the chain:<\/p>\n<pre>$('#hoverme-stop-2').hover(function() {\n  $(this).find('img').stop(true, true).fadeOut();\n}, function() {\n  $(this).find('img').stop(true, true).fadeIn();\n});<\/pre>\n\n<h2>Toggling Animations<\/h2>\n<p><strong>As of jQuery 1.7,<\/strong> stopping a toggled animation prematurely with <code>.stop()<\/code> will trigger jQuery's internal effects tracking. In previous versions, calling the <code>.stop()<\/code> method before a toggled animation was completed would cause the animation to lose track of its state (if jumpToEnd was false). Any subsequent animations would start at a new \"half-way\" state, sometimes resulting in the element disappearing. To observe the new behavior, see the final example below.<\/p>\n\n<blockquote><p>Animations may be stopped globally by setting the property <code>$.fx.off<\/code> to <code>true<\/code>. When this is done, all animation methods will immediately set elements to their final state when called, rather than displaying an effect.<\/p><\/blockquote>\n","categories":["Effects > Custom","Version > Version 1.2","Version > Version 1.7"],"download":""},{"url":"http:\/\/api.jquery.com\/submit\/","name":"submit","title":".submit()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]},{"added":"1.0"}],"desc":"Bind an event handler to the \"submit\" JavaScript event, or trigger that event on an element.","longdesc":"\n<p>This method is a shortcut for <code>.bind('submit', handler)<\/code> in the first variation, and <code>.trigger('submit')<\/code> in the third.<\/p>\n<p>The <code>submit<\/code> event is sent to an element when the user is attempting to submit a form. It can only be attached to <code>&lt;form&gt;<\/code> elements. Forms can be submitted either by clicking an explicit <code>&lt;input type=\"submit\"&gt;<\/code>, <code>&lt;input type=\"image\"&gt;<\/code>, or <code>&lt;button type=\"submit\"&gt;<\/code>, or by pressing <kbd>Enter<\/kbd> when certain form elements have focus.<\/p>\n<blockquote><p>Depending on the browser, the Enter key may only cause a form submission if the form has exactly one text field, or only when there is a submit button present. The interface should not rely on a particular behavior for this key unless the issue is forced by observing the keypress event for presses of the Enter key.<\/p><\/blockquote>\n<p>For example, consider the HTML:<\/p>\n<pre>&lt;form id=\"target\" action=\"destination.html\"&gt;\n  &lt;input type=\"text\" value=\"Hello there\" \/&gt;\n  &lt;input type=\"submit\" value=\"Go\" \/&gt;\n&lt;\/form&gt;\n&lt;div id=\"other\"&gt;\n  Trigger the handler\n&lt;\/div&gt;<\/pre>\n<p>The event handler can be bound to the form:<\/p>\n<pre>$('#target').submit(function() {\n  alert('Handler for .submit() called.');\n  return false;\n});<\/pre>\n<p>Now when the form is submitted, the message is alerted. This happens prior to the actual submission, so we can cancel the submit action by calling <code>.preventDefault()<\/code> on the event object or by returning <code>false<\/code> from our handler. We can trigger the event manually when another element is clicked:<\/p>\n<pre>$('#other').click(function() {\n  $('#target').submit();\n});<\/pre>\n<p>After this code executes, clicks on <span class=\"output\">Trigger the handler<\/span> will also display the message. In addition, the default <code>submit<\/code> action on the form will be fired, so the form will be submitted.<\/p>\n<p>The JavaScript <code>submit<\/code> event does not bubble in Internet Explorer. However, scripts that rely on event delegation with the <code>submit<\/code> event will work consistently across browsers as of jQuery 1.4, which has normalized the event's behavior. <\/p>\n\n","categories":["Events > Form Events","Forms","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/submit-selector\/","name":"submit","title":":submit Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements of type submit.","longdesc":"<p>The <code>:submit<\/code> selector typically applies to button or input elements. Note that some browsers treat <code>&lt;button&gt;<\/code> element as <code>type=\"default\"<\/code> implicitly while others (such as Internet Explorer) do not.  <\/p>","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/text\/","name":"text","title":".text()","type":"method","signatures":[{"added":"1.0"}],"desc":"Get the combined text contents of each element in the set of matched elements, including their descendants.","longdesc":"<p>Unlike the <code>.html()<\/code> method, <code>.text()<\/code> can be used in both XML and HTML documents. The result of the <code>.text()<\/code> method is a string containing the combined text of all matched elements. (Due to variations in the HTML parsers in different browsers, the text returned may vary in newlines and other white space.) Consider the following HTML:<\/p>\n<pre>&lt;div class=\"demo-container\"&gt;\n  &lt;div class=\"demo-box\"&gt;Demonstration Box&lt;\/div&gt;\n  &lt;ul&gt;\n  &lt;li&gt;list item 1&lt;\/li&gt;\n  &lt;li&gt;list &lt;strong&gt;item&lt;\/strong&gt; 2&lt;\/li&gt;\n  &lt;\/ul&gt;\n  &lt;\/div&gt;\n<\/pre>\n      <p>The code <code>$('div.demo-container').text()<\/code> would produce the following result:<\/p>\n      <p>\n        <code>Demonstration Box list item 1 list item 2<\/code>\n      <\/p>\n      <p>The <code>.text()<\/code> method cannot be used on form inputs or scripts.  To set or get the text value of <code>input<\/code> or <code>textarea<\/code> elements, use the <a href=\"\/val\"><code>.val()<\/code><\/a> method. To get the value of a script element, use the <a href=\"\/html\"><code>.html()<\/code><\/a> method.<\/p>\n      <p>As of jQuery 1.4, the <code>.text()<\/code> method returns the value of text and CDATA nodes as well as element nodes.<\/p>\n    ","categories":["Manipulation > DOM Insertion"," Inside","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/text\/","name":"text","title":".text()","type":"method","signatures":[{"added":"1.0","params":[{"name":"textString","type":"String","optional":"","desc":"A string of text to set as the content of each matched element."}]},{"added":"1.4","params":[{"name":"function(index, text)","type":"Function","optional":"","desc":"A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments."}]}],"desc":"Set the content of each element in the set of matched elements to the specified text.","longdesc":"<p>Unlike the <code>.html()<\/code> method, <code>.text()<\/code> can be used in both XML and HTML documents. <\/p>\n  <p>We need to be aware that this method escapes the string provided as necessary so that it will render correctly in HTML. To do so, it calls the DOM method <code>.createTextNode()<\/code>, which replaces special characters with their HTML entity equivalents (such as <code>&amp;lt;<\/code> for <code>&lt;<\/code>).  Consider the following HTML:<\/p>\n\t\t\t\t<pre>&lt;div class=\"demo-container\"&gt;\n  &lt;div class=\"demo-box\"&gt;Demonstration Box&lt;\/div&gt;\n  &lt;ul&gt;\n    &lt;li&gt;list item 1&lt;\/li&gt;\n    &lt;li&gt;list &lt;strong&gt;item&lt;\/strong&gt; 2&lt;\/li&gt;\n  &lt;\/ul&gt;\n&lt;\/div&gt;\n<\/pre>\n\t<p>The code <code>$('div.demo-container').text('&lt;p&gt;This is a test.&lt;\/p&gt;');<\/code> will produce the following DOM output:<\/p>\n\t<pre>&lt;div class=\"demo-container\"&gt;\n&amp;lt;p&amp;gt;This is a test.&amp;lt;\/p&amp;gt;\n&lt;\/div&gt;<\/pre>\n\t<p>It will appear on a rendered page as though the tags were exposed, like this:<\/p>\n\t<pre>&lt;p&gt;This is a test&lt;\/p&gt;<\/pre>\n\t<p>The <code>.text()<\/code> method cannot be used on input elements.  For input field text, use the <a href=\"\/val\">.val()<\/a> method.<\/p>\n  <p>As of jQuery 1.4, the <code>.text()<\/code> method allows us to set the text content by passing in a function.<\/p>\n<pre>$('ul li').text(function(index) {\n  return 'item number ' + (index + 1);\n});<\/pre>\n  <p>Given an unordered list with three <code>&lt;li&gt;<\/code> elements, this example will produce the following DOM output:<\/p>\n<pre>&lt;ul&gt;\n  &lt;li&gt;item number 1&lt;\/li&gt;\n  &lt;li&gt;item number 2&lt;\/li&gt;\n  &lt;li&gt;item number 3&lt;\/li&gt;\n&lt;\/ul&gt;\n<\/pre>\n","categories":["Manipulation > DOM Insertion"," Inside","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/text-selector\/","name":"text","title":":text Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements of type text.","longdesc":"<p><code>$(':text')<\/code> allows us to select all <code>&lt;input type=\"text\"&gt;<\/code> elements. As with other pseudo-class selectors (those that begin with a \":\") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector (\"*\") is implied. In other words, the bare <code>$(':text')<\/code> is equivalent to <code>$('*:text')<\/code>, so <code>$('input:text')<\/code> should be used instead. <\/p>\n<p><strong>Note:<\/strong> As of jQuery 1.5.2, <code>:text<\/code> selects <code>input<\/code> elements that have no specified <code>type<\/code> attribute (in which case <code>type=\"text\"<\/code> is implied).  <\/p>\n<p>This difference in behavior between <code>$(':text')<\/code> and <code>$('[type=text]')<\/code>, can be seen below:<\/p><pre>$('&lt;input&gt;').is('[type=text]'); \/\/ false\n$('&lt;input&gt;').is(':text'); \/\/ true\n<\/pre>\n","categories":["Selectors > Form","Selectors > jQuery Extensions","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/toArray\/","name":"toArray","title":".toArray()","type":"method","signatures":[{"added":"1.4"}],"desc":"Retrieve all the DOM elements contained in the jQuery set, as an array.","longdesc":"<p><code>.toArray()<\/code> returns all of the elements in the jQuery set:<\/p>\n<pre>alert($('li').toArray());<\/pre>\n<p>All of the matched DOM nodes are returned by this call, contained in a standard array:<\/p>\n<p><span class=\"result\">[&lt;li id=\"foo\"&gt;, &lt;li id=\"bar\"&gt;]<\/span><\/p>","categories":["Miscellaneous > DOM Element Methods","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/toggle\/","name":"toggle","title":".toggle()","type":"method","signatures":[{"added":"1.0","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.4.3","params":[{"name":"duration","type":"String,Number","optional":"optional","desc":"A string or number determining how long the animation will run."},{"name":"easing","type":"String","optional":"optional","desc":"A string indicating which easing function to use for the transition."},{"name":"callback","type":"Callback","optional":"optional","desc":"A function to call once the animation is complete."}]},{"added":"1.3","params":[{"name":"showOrHide","type":"Boolean","optional":"","desc":"A Boolean indicating whether to show or hide the elements."}]}],"desc":"Display or hide the matched elements.","longdesc":"\n<blockquote><p>Note: The event handling suite also has a method named <a href=\"http:\/\/api.jquery.com\/toggle-event\/\">.toggle()<\/a>. Which one is fired depends on the set of arguments passed.<\/p><\/blockquote>\n<p>With no parameters, the <code>.toggle()<\/code> method simply toggles the visibility of elements:<\/p>\n<pre>$('.target').toggle();\n<\/pre>\n<p>The matched elements will be revealed or hidden immediately, with no animation, by changing the CSS <code>display<\/code> property. If the element is initially displayed, it will be hidden; if hidden, it will be shown. The <code>display<\/code> property is saved and restored as needed. If an element has a <code>display<\/code> value of <code>inline<\/code>, then is hidden and shown, it will once again be displayed <code>inline<\/code>.<\/p>\n<p>When a duration is provided, <code>.toggle()<\/code> becomes an animation method. The <code>.toggle()<\/code> method animates the width, height, and opacity of the matched elements simultaneously. When these properties reach 0 after a hiding animation, the <code>display<\/code> style property is set to <code>none<\/code> to ensure that the element no longer affects the layout of the page.<\/p>\n<p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'<\/code> and <code>'slow'<\/code> can be supplied to indicate durations of <code>200<\/code> and <code>600<\/code> milliseconds, respectively.<\/p>\n    <p>As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called <code>swing<\/code>, and one that progresses at a constant pace, called <code>linear<\/code>. More easing functions are available with the use of plug-ins, most notably the <a href=\"http:\/\/jqueryui.com\">jQuery UI suite<\/a>.<\/p>\n<p>If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but <code>this<\/code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<\/p>\n<p>We can animate any element, such as a simple image:<\/p>\n<pre>&lt;div id=\"clickme\"&gt;\n  Click here\n&lt;\/div&gt;\n&lt;img id=\"book\" src=\"book.png\" alt=\"\" width=\"100\" height=\"123\" \/&gt;\n<\/pre>\n<p>We will cause <code>.toggle()<\/code> to be called when another element is clicked:<\/p>\n<pre>$('#clickme').click(function() {\n  $('#book').toggle('slow', function() {\n    \/\/ Animation complete.\n  });\n});\n<\/pre>\n<p>With the element initially shown, we can hide it slowly with the first click:\n<\/p>\n<p class=\"image four-across\"> \n<img src=\"\/images\/0042_06_09.png\" alt=\"\"\/>\n<img src=\"\/images\/0042_06_10.png\" alt=\"\"\/>\n<img src=\"\/images\/0042_06_11.png\" alt=\"\"\/>\n<img src=\"\/images\/0042_06_12.png\" alt=\"\"\/>\n<\/p>\n<p>A second click will show the element once again:<\/p>\n<p class=\"image four-across\"><img src=\"\/images\/0042_06_13.png\" alt=\"\"\/>\n<img src=\"\/images\/0042_06_14.png\" alt=\"\"\/>\n<img src=\"\/images\/0042_06_15.png\" alt=\"\"\/>\n<img src=\"\/images\/0042_06_16.png\" alt=\"\"\/>\n<\/p>\n<p>The second version of the method accepts a Boolean parameter. If this parameter is <code>true<\/code>, then the matched elements are shown; if <code>false<\/code>, the elements are hidden. In essence, the statement:\n<\/p>\n<pre>$('#foo').toggle(showOrHide);<\/pre>\n<p>is equivalent to:<\/p>\n<pre>if ( showOrHide == true ) {\n  $('#foo').show();\n} else if ( showOrHide == false ) {\n  $('#foo').hide();\n}\n<\/pre>","categories":["Effects > Basics","Version > Version 1.0","Version > Version 1.3","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/toggle-event\/","name":"toggle","title":".toggle()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute every even time the element is clicked."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute every odd time the element is clicked."},{"name":"handler(eventObject)","type":"Function","optional":"optional","desc":"Additional handlers to cycle through after clicks."}]}],"desc":"Bind two or more handlers to the matched elements, to be executed on alternate clicks.","longdesc":"\n<blockquote><p>Note: jQuery also provides an animation method named <a href=\"http:\/\/api.jquery.com\/toggle\/\">.toggle()<\/a> that toggles the visibility of elements. Whether the animation or the event method is fired depends on the set of arguments passed.<\/p><\/blockquote>\n\n<p>The <code>.toggle()<\/code> method binds a handler for the <code>click<\/code> event, so the rules outlined for the triggering of <code>click<\/code> apply here as well.<\/p>\n<pre>For example, consider the HTML:\n&lt;div id=\"target\"&gt;\n  Click here\n&lt;\/div&gt;<\/pre>\n \n<p>Event handlers can then be bound to the <code>&lt;div&gt;<\/code>:<\/p>\n<pre>$('#target').toggle(function() {\n  alert('First handler for .toggle() called.');\n}, function() {\n  alert('Second handler for .toggle() called.');\n});<\/pre>\n<p>As the element is clicked repeatedly, the messages alternate:<\/p>\n<p>\n  <span class=\"output\">First handler for .toggle() called.<\/span><br\/>\n  <span class=\"output\">Second handler for .toggle() called.<\/span><br\/>\n  <span class=\"output\">First handler for .toggle() called.<\/span><br\/>\n  <span class=\"output\">Second handler for .toggle() called.<\/span><br\/>\n  <span class=\"output\">First handler for .toggle() called.<\/span>\n<\/p>\n<p>If more than two handlers are provided, <code>.toggle()<\/code> will cycle among all of them. For example, if there are three handlers, then the first handler will be called on the first click, the fourth click, the seventh click, and so on.<\/p>\n<p>The <code>.toggle()<\/code> method is provided for convenience. It is relatively straightforward to implement the same behavior by hand, and this can be necessary if the assumptions built into <code>.toggle()<\/code> prove limiting. For example, <code>.toggle()<\/code> is not guaranteed to work correctly if applied twice to the same element. Since <code>.toggle()<\/code> internally uses a <code>click<\/code> handler to do its work, we must unbind <code>click<\/code> to remove a behavior attached with <code>.toggle()<\/code>, so other <code>click<\/code> handlers can be caught in the crossfire. The implementation also calls <code>.preventDefault()<\/code> on the event, so links will not be followed and buttons will not be clicked if <code>.toggle()<\/code> has been called on the element.<\/p>\n","categories":["Events > Mouse Events","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/toggleClass\/","name":"toggleClass","title":".toggleClass()","type":"method","signatures":[{"added":"1.0","params":[{"name":"className","type":"String","optional":"","desc":"One or more class names (separated by spaces) to be toggled for each element in the matched set."}]},{"added":"1.3","params":[{"name":"className","type":"String","optional":"","desc":"One or more class names (separated by spaces) to be toggled for each element in the matched set."},{"name":"switch","type":"Boolean","optional":"","desc":"A Boolean (not just truthy\/falsy) value to determine whether the class should be added or removed."}]},{"added":"1.4","params":[{"name":"switch","type":"Boolean","optional":"optional","desc":"A boolean value to determine whether the class should be added or removed."}]},{"added":"1.4","params":[{"name":"function(index, class, switch)","type":"Function","optional":"","desc":"A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments."},{"name":"switch","type":"Boolean","optional":"optional","desc":"A boolean value to determine whether the class should be added or removed."}]}],"desc":"Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.","longdesc":"<p>This method takes one or more class names as its parameter. In the first version, if an element in the matched set of elements already has the class, then it is removed; if an element does not have the class, then it is added. For example, we can apply <code>.toggleClass()<\/code> to a simple <code>&lt;div&gt;<\/code>: <\/p>\n      <pre>&lt;div class=\"tumble\"&gt;Some text.&lt;\/div&gt;\n      <\/pre>\n      <p>The first time we apply <code>$('div.tumble').toggleClass('bounce')<\/code>, we get the following:<\/p>\n      <pre>&lt;div class=\"tumble bounce\"&gt;Some text.&lt;\/div&gt;\n      <\/pre>\n      <p>The second time we apply <code>$('div.tumble').toggleClass('bounce')<\/code>, the <code>&lt;div&gt;<\/code> class is returned to the single <code>tumble<\/code> value:<\/p>\n      <pre>&lt;div class=\"tumble\"&gt;Some text.&lt;\/div&gt;<\/pre>\n      <p>Applying <code>.toggleClass('bounce spin')<\/code> to the same <code>&lt;div&gt;<\/code> alternates between <code>&lt;div class=\"tumble bounce spin\"&gt;<\/code> and <code>&lt;div class=\"tumble\"&gt;<\/code>.<\/p>\n      <p>The second version of <code>.toggleClass()<\/code> uses the second parameter for determining whether the class should be added or removed. If this parameter's value is <code>true<\/code>, then the class is added; if <code>false<\/code>, the class is removed. In essence, the statement:<\/p>\n  <pre>$('#foo').toggleClass(className, addOrRemove);<\/pre>\n  <p>is equivalent to:<\/p>\n  <pre>if (addOrRemove) {\n    $('#foo').addClass(className);\n  }\n  else {\n    $('#foo').removeClass(className);\n  }\n  <\/pre>\n  <p><strong>As of jQuery 1.4<\/strong>, if no arguments are passed to <code>.toggleClass()<\/code>, all class names on the element the first time <code>.toggleClass()<\/code> is called will be toggled. Also as of jQuery 1.4, the class name to be toggled can be determined by passing in a function.<\/p>\n<pre>$('div.foo').toggleClass(function() {\n  if ($(this).parent().is('.bar')) {\n    return 'happy';\n  } else {\n    return 'sad';\n  }\n});<\/pre>\n  <p>This example will toggle the <code>happy<\/code> class for <code>&lt;div class=\"foo\"&gt;<\/code> elements if their parent element has a class of <code>bar<\/code>; otherwise, it will toggle the <code>sad<\/code> class.<\/p>\n","categories":["Attributes","Manipulation > Class Attribute","CSS","Version > Version 1.0","Version > Version 1.3","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/trigger\/","name":"trigger","title":".trigger()","type":"method","signatures":[{"added":"1.0","params":[{"name":"eventType","type":"String","optional":"","desc":"A string containing a JavaScript event type, such as <code>click<\/code> or <code>submit<\/code>."},{"name":"extraParameters","type":"Object","optional":"optional","desc":"Additional parameters to pass along to the event handler."}]},{"added":"1.3","params":[{"name":"event","type":"Event","optional":"","desc":"A <a href=\"http:\/\/api.jquery.com\/category\/events\/event-object\/\"><code>jQuery.Event<\/code><\/a> object."}]}],"desc":"Execute all handlers and behaviors attached to the matched elements for the given event type.","longdesc":"\n    <p>Any event handlers attached with <code>.bind()<\/code> or one of its shortcut methods are triggered when the corresponding event occurs. They can be fired manually, however, with the <code>.trigger()<\/code> method. A call to <code>.trigger()<\/code> executes the handlers in the same order they would be if the event were triggered naturally by the user:<\/p>\n    <pre>$('#foo').bind('click', function() {\n      alert($(this).text());\n    });\n    $('#foo').trigger('click');<\/pre>\n    <p>As of jQuery 1.3, <code>.trigger()<\/code>ed events bubble up the DOM tree; an event handler can stop the bubbling by returning <code>false<\/code> from the handler or calling the <a href=\"http:\/\/api.jquery.com\/event.stopPropagation\/\"><code>.stopPropagation()<\/code><\/a> method on the event object passed into the event. Although <code>.trigger()<\/code> simulates an event activation, complete with a synthesized event object, it does not perfectly replicate a naturally-occurring event.<\/p>\n    <p>To trigger handlers bound via jQuery without also triggering the native event, use <a href=\"http:\/\/api.jquery.com\/triggerHandler\/\"><code>.triggerHandler()<\/code><\/a> instead. <\/p>\n    <p>When we define a custom event type using the <code>.bind()<\/code> method, the second argument to <code>.trigger()<\/code> can become useful. For example, suppose we have bound a handler for the <code>custom<\/code> event to our element instead of the built-in <code>click<\/code> event as we did above:<\/p>\n<pre>$('#foo').bind('custom', function(event, param1, param2) {\n  alert(param1 + \"\\n\" + param2);\n});\n$('#foo').trigger('custom', ['Custom', 'Event']);\n<\/pre>\n    <p>The event object is always passed as the first parameter to an event handler, but if additional parameters are specified during a <code>.trigger()<\/code> call, these parameters will be passed along to the handler as well. To pass more than one parameter, use an array as shown here. As of jQuery 1.6.2, a single parameter can be passed without using an array.<\/p>\n    <p>Note the difference between the extra parameters we're passing here and the <code>eventData<\/code> parameter to the <a href=\"\/bind\/\">.bind()<\/a> method. Both are mechanisms for passing information to an event handler, but the <code>extraParameters<\/code> argument to <code>.trigger()<\/code> allows information to be determined at the time the event is triggered, while the <code>eventData<\/code> argument to <code>.bind()<\/code> requires the information to be already computed at the time the handler is bound.<\/p>\n   <p>The <code>.trigger()<\/code> method can be used on jQuery collections that wrap plain JavaScript objects similar to a pub\/sub mechanism; any event handlers bound to the object will be called when the event is triggered. <\/p>\n<blockquote><strong>Note:<\/strong> For both plain objects and DOM objects, if a triggered event name matches the name of a property on the object, jQuery will attempt to invoke the property as a method if no event handler calls <code>event.preventDefault()<\/code>. If this behavior is not desired, use <code>.triggerHandler()<\/code> instead.<\/blockquote>\n  ","categories":["Events > Event Handler Attachment","Version > Version 1.0"],"download":""},{"url":"http:\/\/api.jquery.com\/triggerHandler\/","name":"triggerHandler","title":".triggerHandler()","type":"method","signatures":[{"added":"1.2","params":[{"name":"eventType","type":"String","optional":"","desc":"A string containing a JavaScript event type, such as <code>click<\/code> or <code>submit<\/code>."},{"name":"extraParameters","type":"Array","optional":"optional","desc":"An array of additional parameters to pass along to the event handler."}]}],"desc":"Execute all handlers attached to an element for an event.","longdesc":"\n    <p>The <code>.triggerHandler()<\/code> method behaves similarly to <code>.trigger()<\/code>, with the following exceptions:<\/p>\n    <ul>\n    <li>The <code>.triggerHandler()<\/code> method does not cause the default behavior of an event to occur (such as a form submission).<\/li>\n    <li>While <code>.trigger()<\/code> will operate on all elements matched by the jQuery object, <code>.triggerHandler()<\/code> only affects the first matched element.<\/li>\n    <li>Events created with <code>.triggerHandler()<\/code> do not bubble up the DOM hierarchy; if they are not handled by the target element directly, they do nothing.<\/li>\n    <li>Instead of returning the jQuery object (to allow chaining), <code>.triggerHandler()<\/code> returns whatever value was returned by the last handler it caused to be executed. If no handlers are triggered, it returns <code>undefined<\/code><\/li>\n    <\/ul>\n    <p>For more information on this method, see the discussion for <code><a href=\"\/trigger\">.trigger()<\/a><\/code>.<\/p>\n  ","categories":["Events > Event Handler Attachment","Version > Version 1.2"],"download":""},{"url":"http:\/\/api.jquery.com\/unbind\/","name":"unbind","title":".unbind()","type":"method","signatures":[{"added":"1.0","params":[{"name":"eventType","type":"String","optional":"optional","desc":"A string containing a JavaScript event type, such as <code>click<\/code> or <code>submit<\/code>."},{"name":"handler(eventObject)","type":"Function","optional":"optional","desc":"The function that is to be no longer executed."}]},{"added":"1.4.3","params":[{"name":"eventType","type":"String","optional":"","desc":"A string containing a JavaScript event type, such as <code>click<\/code> or <code>submit<\/code>."},{"name":"false","type":"Boolean","optional":"","desc":"Unbinds the corresponding 'return false' function that was bound using <code>.bind( eventType, false )<\/code>."}]},{"added":"1.0","params":[{"name":"event","type":"Object","optional":"","desc":"A JavaScript event object as passed to an event handler."}]}],"desc":"Remove a previously-attached event handler from the elements.","longdesc":"\n<p>Event handlers attached with <code>.bind()<\/code> can be removed with <code>.unbind()<\/code>. (As of jQuery 1.7, the <a href=\"http:\/\/api.jquery.com\/on\"><code>.on()<\/code><\/a> and <a href=\"http:\/\/api.jquery.com\/off\"><code>.off()<\/code><\/a> methods are preferred to attach and remove event handlers on elements.) In the simplest case, with no arguments, <code>.unbind()<\/code> removes all handlers attached to the elements:<\/p>\n<pre>$('#foo').unbind();<\/pre>\n<p>This version removes the handlers regardless of type. To be more precise, we can pass an event type:<\/p>\n<pre>$('#foo').unbind('click');<\/pre>\n<p>By specifying the <code>click<\/code> event type, only handlers for that event type will be unbound. This approach can still have negative ramifications if other scripts might be attaching behaviors to the same element, however. Robust and extensible applications typically demand the two-argument version for this reason:<\/p>\n<pre>var handler = function() {\n  alert('The quick brown fox jumps over the lazy dog.');\n};\n$('#foo').bind('click', handler);\n$('#foo').unbind('click', handler);\n<\/pre>\n<p>By naming the handler, we can be assured that no other functions are accidentally removed. Note that the following will <em>not<\/em> work:<\/p>\n<pre>$('#foo').bind('click', function() {\n  alert('The quick brown fox jumps over the lazy dog.');\n});\n\n\/\/ will NOT work\n$('#foo').unbind('click', function() {\n  alert('The quick brown fox jumps over the lazy dog.');\n});<\/pre>\n<p>Even though the two functions are identical in content, they are created separately and so JavaScript is free to keep them as distinct function objects. To unbind a particular handler, we need a reference to that function and not a different one that happens to do the same thing.<\/p>\n<blockquote><p><strong>Note:<\/strong> Using a proxied function to unbind an event on an element will unbind all proxied functions on that element, as the same proxy function is used for all proxied events. To allow unbinding a specific event, use unique class names on the event (e.g. <code>click.proxy1<\/code>, <code>click.proxy2<\/code>) when attaching them.<\/p><\/blockquote>\n<h4>Using Namespaces<\/h4>\n<p>Instead of maintaining references to handlers in order to unbind them, we can namespace the events and use this capability to narrow the scope of our unbinding actions. As shown in the discussion for the <code>.bind()<\/code> method, namespaces are defined by using a period (<code>.<\/code>) character when binding a handler:<\/p>\n<pre>$('#foo').bind('click.myEvents', handler);<\/pre>\n<p>When a handler is bound in this fashion, we can still unbind it the normal way:<\/p>\n<pre>$('#foo').unbind('click');<\/pre>\n<p>However, if we want to avoid affecting other handlers, we can be more specific:<\/p>\n<pre>$('#foo').unbind('click.myEvents');<\/pre>\n<p>We can also unbind all of the handlers in a namespace, regardless of event type:<\/p>\n<pre>$('#foo').unbind('.myEvents');<\/pre>\n<p>It is particularly useful to attach namespaces to event bindings when we are developing plug-ins or otherwise writing code that may interact with other event-handling code in the future.<\/p>\n<h4>Using the Event Object<\/h4>\n<p>The third form of the <code>.unbind()<\/code> method is used when we wish to unbind a handler from within itself. For example, suppose we wish to trigger an event handler only three times:<\/p>\n<pre>var timesClicked = 0;\n$('#foo').bind('click', function(event) {\n  alert('The quick brown fox jumps over the lazy dog.');\n  timesClicked++;\n  if (timesClicked &gt;= 3) {\n    $(this).unbind(event);\n  }\n});\n<\/pre>\n<p>The handler in this case must take a parameter, so that we can capture the event object and use it to unbind the handler after the third click. The event object contains the context necessary for <code>.unbind()<\/code> to know which handler to remove.\nThis example is also an illustration of a closure. Since the handler refers to the <code>timesClicked<\/code> variable, which is defined outside the function, incrementing the variable has an effect even between invocations of the handler.<\/p>\n","categories":["Events > Event Handler Attachment","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/undelegate\/","name":"undelegate","title":".undelegate()","type":"method","signatures":[{"added":"1.4.2"},{"added":"1.4.2","params":[{"name":"selector","type":"String","optional":"","desc":"A selector which will be used to filter the event results."},{"name":"eventType","type":"String","optional":"","desc":"A string containing a JavaScript event type, such as \"click\" or \"keydown\""}]},{"added":"1.4.2","params":[{"name":"selector","type":"String","optional":"","desc":"A selector which will be used to filter the event results."},{"name":"eventType","type":"String","optional":"","desc":"A string containing a JavaScript event type, such as \"click\" or \"keydown\""},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute at the time the event is triggered."}]},{"added":"1.4.3","params":[{"name":"selector","type":"String","optional":"","desc":"A selector which will be used to filter the event results."},{"name":"events","type":"Map","optional":"","desc":"A map of one or more event types and previously bound functions to unbind from them."}]},{"added":"1.6","params":[{"name":"namespace","type":"String","optional":"","desc":"A string containing a namespace to unbind all events from."}]}],"desc":"Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.","longdesc":"\n  <p>The <code>.undelegate()<\/code> method is a way of removing event handlers that have been bound using <a href=\"\/delegate\"><code>.delegate()<\/code><\/a>. <strong>As of jQuery 1.7<\/strong>, the <a href=\"http:\/\/api.jquery.com\/on\"><code>.on()<\/code><\/a> and <a href=\"http:\/\/api.jquery.com\/off\"><code>.off()<\/code><\/a> methods are preferred for attaching and removing event handlers.<\/p>\n","categories":["Events > Event Handler Attachment","Version > Version 1.4.2","Version > Version 1.4.3","Version > Version 1.6"],"download":""},{"url":"http:\/\/api.jquery.com\/unload\/","name":"unload","title":".unload()","type":"method","signatures":[{"added":"1.0","params":[{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute when the event is triggered."}]},{"added":"1.4.3","params":[{"name":"eventData","type":"Object","optional":"optional","desc":"A map of data that will be passed to the event handler."},{"name":"handler(eventObject)","type":"Function","optional":"","desc":"A function to execute each time the event is triggered."}]}],"desc":"Bind an event handler to the \"unload\" JavaScript event.","longdesc":"\n<p>This method is a shortcut for <code>.bind('unload', handler)<\/code>.<\/p>\n<p>The <code>unload<\/code> event is sent to the <code>window<\/code> element when the user navigates away from the page. This could mean one of many things. The user could have clicked on a link to leave the page, or typed in a new URL in the address bar. The forward and back buttons will trigger the event. Closing the browser window will cause the event to be triggered. Even a page reload will first create an <code>unload<\/code> event.<\/p>\n<blockquote><p>The exact handling of the <code>unload<\/code> event has varied from version to version of browsers. For example, some versions of Firefox trigger the event when a link is followed, but not when the window is closed. In practical usage, behavior should be tested on all supported browsers, and contrasted with the proprietary <code>beforeunload<\/code> event.<\/p><\/blockquote>\n<p>Any <code>unload<\/code> event handler should be bound to the <code>window<\/code> object:<\/p>\n<pre>$(window).unload(function() {\n  alert('Handler for .unload() called.');\n});\n<\/pre>\n<p>After this code executes, the alert will be displayed whenever the browser leaves the current page.\nIt is not possible to cancel the <code>unload<\/code> event with <code>.preventDefault()<\/code>. This event is available so that scripts can perform cleanup when the user leaves the page.\n<\/p>\n","categories":["Events > Document Loading","Version > Version 1.0","Version > Version 1.4.3"],"download":""},{"url":"http:\/\/api.jquery.com\/unwrap\/","name":"unwrap","title":".unwrap()","type":"method","signatures":[{"added":"1.4"}],"desc":"Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.","longdesc":"<p>The <code>.unwrap()<\/code> method removes the element's parent. This is effectively the inverse of the <code><a href=\"\/wrap\">.wrap()<\/a><\/code> method. The matched elements (and their siblings, if any) replace their parents within the DOM structure.<\/p>","categories":["Manipulation > DOM Insertion"," Around","Manipulation > DOM Removal","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/val\/","name":"val","title":".val()","type":"method","signatures":[{"added":"1.0"}],"desc":"Get the current value of the first element in the set of matched elements.","longdesc":"\n      <p>The <code>.val()<\/code> method is primarily used to get the values of form elements such as <code>input<\/code>, <code>select<\/code> and <code>textarea<\/code>. In the case of <code>&lt;select multiple=\"multiple\"&gt;<\/code> elements, the <code>.val()<\/code> method returns an array containing each selected option; if no option is selected, it returns <code>null<\/code>. <\/p>\n\n<p>For selects and checkboxes, you can also use the <a href=\"\/selected\">:selected<\/a> and <a href=\"\/checked\">:checked<\/a> selectors to get at values, for example:<\/p>\n<pre>$('select.foo option:selected').val();    \/\/ get the value from a dropdown select\n$('select.foo').val();                    \/\/ get the value from a dropdown select even easier\n$('input:checkbox:checked').val();        \/\/ get the value from a checked checkbox\n$('input:radio[name=bar]:checked').val(); \/\/ get the value from a set of radio buttons<\/pre>\n\n<blockquote><p><strong>Note: <\/strong> At present, using <code>.val()<\/code> on textarea elements strips carriage return characters from the browser-reported value. When this value is sent to the server via XHR however, carriage returns are preserved (or added by browsers which do not include them in the raw value). A workaround for this issue can be achieved using a valHook as follows:<\/p><\/blockquote>\n\n<pre>\n$.valHooks.textarea = {\n\u00a0 \u00a0\u00a0get: function( elem ) {\n\u00a0 \u00a0 \u00a0 \u00a0\u00a0return elem.value.replace( \/\\r?\\n\/g, \"\\r\\n\" );\n\u00a0 \u00a0\u00a0}\n};\n<\/pre>\n","categories":["Attributes","Forms","Manipulation > General Attributes","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/val\/","name":"val","title":".val()","type":"method","signatures":[{"added":"1.0","params":[{"name":"value","type":"String","optional":"","desc":"A string of text or an array of strings corresponding to the value of each matched element to set as selected\/checked."}]},{"added":"1.4","params":[{"name":"function(index, value)","type":"Function","optional":"","desc":"A function returning the value to set. <code>this<\/code> is the current element. Receives the index position of the element in the set and the old value as arguments."}]}],"desc":"Set the value of each element in the set of matched elements.","longdesc":"<p>This method is typically used to set the values of form fields. <\/p>\n<p>Passing an array of element values allows matching  <code>&lt;input type=\"checkbox\"&gt;<\/code>, <code>&lt;input type=\"radio\"&gt;<\/code> and <code>&lt;option&gt;<\/code>s inside of n <code>&lt;select multiple=\"multiple\"&gt;<\/code> to be selected. In the case of <code>&lt;input type=\"radio\"&gt;<\/code>s that are part of a radio group and <code>&lt;select multiple=\"multiple\"&gt;<\/code> the other elements will be deselected.<\/p>\n    <p>The <code>.val()<\/code> method allows us to set the value by passing in a function. As of jQuery 1.4, the function is passed two arguments, the current element's index and its current value: <\/p>\n<pre>$('input:text.items').val(function( index, value ) {\n  return value + ' ' + this.className;\n});\n<\/pre>\n  <p>This example appends the string \" items\" to the text inputs' values.<\/p>\n  ","categories":["Attributes","Forms","Manipulation > General Attributes","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/visible-selector\/","name":"visible","title":":visible Selector","type":"selector","signatures":[{"added":"1.0"}],"desc":"Selects all elements that are visible.","longdesc":" <p>Elements are considered visible if they consume space in the document. Visible elements have a width or height that is greater than zero.<\/p>\n<p>Elements with <code>visibility: hidden<\/code> or <code>opacity: 0<\/code> are considered visible, since they still consume space in the layout. During animations that hide an element, the element is considered to be visible until the end of the animation. During animations to show an element, the element is considered to be visible at the start at the animation.<\/p>\n<p>How <code>:visible<\/code> is calculated was changed in jQuery 1.3.2. The <a href=\"http:\/\/docs.jquery.com\/Release:jQuery_1.3.2#:visible.2F:hidden_Overhauled\">release notes<\/a> outline the changes in more detail.<\/p>","categories":["Selectors > jQuery Extensions","Version > Version 1.0","Selectors > Visibility Filter"],"download":""},{"url":"http:\/\/api.jquery.com\/width\/","name":"width","title":".width()","type":"method","signatures":[{"added":"1.0"}],"desc":"Get the current computed width for the first element in the set of matched elements.","longdesc":"\n     <p>The difference between <code>.css(width)<\/code> and <code>.width()<\/code> is that the latter returns a unit-less pixel value (for example, <code>400<\/code>) while the former returns a value with units intact (for example, <code>400px<\/code>). The <code>.width()<\/code> method is recommended when an element's width needs to be used in a mathematical calculation.<\/p>\n    <p class=\"image\"><img src=\"\/images\/0042_04_04.png\"\/><\/p>\n    <p>This method is also able to find the width of the window and document.<\/p>\n\n<pre>$(window).width();   \/\/ returns width of browser viewport\n$(document).width(); \/\/ returns width of HTML document<\/pre>\n\n<p>Note that <code>.width()<\/code> will always return the content width, regardless of the value of the CSS <code>box-sizing<\/code> property.<\/p>\n","categories":["CSS","Dimensions","Manipulation > Style Properties","Version > Version 1.0","Version > Version 1.4.1"],"download":""},{"url":"http:\/\/api.jquery.com\/width\/","name":"width","title":".width()","type":"method","signatures":[{"added":"1.0","params":[{"name":"value","type":"String, Number","optional":"","desc":"An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string)."}]},{"added":"1.4.1","params":[{"name":"function(index, width)","type":"Function","optional":"","desc":"A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, <code>this<\/code> refers to the current element in the set."}]}],"desc":"Set the CSS width of each element in the set of matched elements.","longdesc":"\n      <p>When calling <code>.width(\"value\")<\/code>, the value can be either a string (number and unit) or a number. If only a number is provided for the value, jQuery assumes a pixel unit. If a string is provided, however, any valid CSS measurement may be used for the width (such as <code>100px<\/code>, <code>50%<\/code>, or <code>auto<\/code>). Note that in modern browsers, the CSS width property does not include padding, border, or margin, unless the <code>box-sizing<\/code> CSS property is used.<\/p>\n    <p>If no explicit unit is specified (like \"em\" or \"%\") then \"px\" is assumed.<\/p>\n    <p>Note that <code>.width(\"value\")<\/code> sets the width of the box in accordance with the CSS <code>box-sizing<\/code> property. Changing this property to <code>border-box<\/code> will cause this function to change the <code>outerWidth<\/code> of the box instead of the content width.<\/p>\n  ","categories":["CSS","Dimensions","Manipulation > Style Properties","Version > Version 1.0","Version > Version 1.4.1"],"download":""},{"url":"http:\/\/api.jquery.com\/wrap\/","name":"wrap","title":".wrap()","type":"method","signatures":[{"added":"1.0","params":[{"name":"wrappingElement","type":"String, Selector, Element, jQuery","optional":"","desc":"An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements."}]},{"added":"1.4","params":[{"name":"function(index)","type":"Function","optional":"","desc":"A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, <code>this<\/code> refers to the current element in the set."}]}],"desc":"Wrap an HTML structure around each element in the set of matched elements.","longdesc":"<p>The <code>.wrap()<\/code> function can take any string or object that could be passed to the <code>$()<\/code> factory function to specify a DOM structure. This structure may be nested several levels deep, but should contain only one inmost element. A copy of this structure will be wrapped around each of the elements in the set of matched elements. This method returns the original set of elements for chaining purposes.<\/p>\n  <p>Consider the following HTML:<\/p>\n  <pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>Using <code>.wrap()<\/code>, we can insert an HTML structure around the inner <code>&lt;div&gt;<\/code> elements like so:<\/p>\n\t\t\t\t<pre>$('.inner').wrap('&lt;div class=\"new\" \/&gt;');<\/pre>\n\t\t\t\t<p>The new <code>&lt;div&gt;<\/code> element is created on the fly and added to the DOM. The result is a new <code>&lt;div&gt;<\/code> wrapped around each matched element:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"new\"&gt;\n    &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;\/div&gt;\n  &lt;div class=\"new\"&gt;\n    &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n  <p>The second version of this method allows us to instead specify a callback function. This callback function will be called once for every matched element; it should return a DOM element, jQuery object, or HTML snippet in which to wrap the corresponding element. For example:<\/p>\n  <pre>$('.inner').wrap(function() {\n  return '&lt;div class=\"' + $(this).text() + '\" \/&gt;';\n});<\/pre>\n  <p>This will cause each <code>&lt;div&gt;<\/code> to have a class corresponding to the text it wraps:<\/p>\n  <pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"Hello\"&gt;\n    &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;\/div&gt;\n  &lt;div class=\"Goodbye\"&gt;\n    &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n","categories":["Manipulation > DOM Insertion"," Around","Version > Version 1.0","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/wrapAll\/","name":"wrapAll","title":".wrapAll()","type":"method","signatures":[{"added":"1.2","params":[{"name":"wrappingElement","type":"String, Selector, Element, jQuery","optional":"","desc":"An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements."}]}],"desc":"Wrap an HTML structure around all elements in the set of matched elements.","longdesc":"<p>The <code>.wrapAll()<\/code> function can take any string or object that could be passed to the <code>$()<\/code> function to specify a DOM structure. This structure may be nested several levels deep, but should contain only one inmost element. The structure will be wrapped around all of the elements in the set of matched elements, as a single group.<\/p>\n\t\t\t\t<p>Consider the following HTML:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>Using <code>.wrapAll()<\/code>, we can insert an HTML structure around the inner <code>&lt;div&gt;<\/code> elements like so:<\/p>\n\t\t\t\t<pre>$('.inner').wrapAll('&lt;div class=\"new\" \/&gt;');<\/pre>\n\t\t\t\t<p>The new <code>&lt;div&gt;<\/code> element is created on the fly and added to the DOM. The result is a new <code>&lt;div&gt;<\/code> wrapped around all matched elements:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"new\"&gt;\n    &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n    &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>","categories":["Manipulation > DOM Insertion"," Around","Version > Version 1.2","Version > Version 1.4"],"download":""},{"url":"http:\/\/api.jquery.com\/wrapInner\/","name":"wrapInner","title":".wrapInner()","type":"method","signatures":[{"added":"1.2","params":[{"name":"wrappingElement","type":"String","optional":"","desc":"An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements."}]},{"added":"1.4","params":[{"name":"function(index)","type":"Function","optional":"","desc":"A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, <code>this<\/code> refers to the current element in the set."}]}],"desc":"Wrap an HTML structure around the content of each element in the set of matched elements.","longdesc":"<p>The <code>.wrapInner()<\/code> function can take any string or object that could be passed to the <code>$()<\/code> factory function to specify a DOM structure. This structure may be nested several levels deep, but should contain only one inmost element. The structure will be wrapped around the content of each of the elements in the set of matched elements.<\/p>\n\t\t\t\t<p>Consider the following HTML:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;Hello&lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;Goodbye&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>Using <code>.wrapInner()<\/code>, we can insert an HTML structure around the content of each inner <code>&lt;div&gt;<\/code> elements like so:<\/p>\n\t\t\t\t<pre>$('.inner').wrapInner('&lt;div class=\"new\" \/&gt;');<\/pre>\n\t\t\t\t<p>The new <code>&lt;div&gt;<\/code> element is created on the fly and added to the DOM. The result is a new <code>&lt;div&gt;<\/code> wrapped around the content of each matched element:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;\n    &lt;div class=\"new\"&gt;Hello&lt;\/div&gt;\n  &lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;\n    &lt;div class=\"new\"&gt;Goodbye&lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\t\t\t\t<p>The second version of this method allows us to instead specify a callback function. This callback function will be called once for every matched element; it should return a DOM element, jQuery object, or HTML snippet in which to wrap the content of the corresponding element. For example:<\/p>\n\t\t\t\t<pre>$('.inner').wrapInner(function() {\n  return '&lt;div class=\"' + this.nodeValue + '\" \/&gt;';\n});<\/pre>\n\t\t\t\t<p>This will cause each <code>&lt;div&gt;<\/code> to have a class corresponding to the text it wraps:<\/p>\n\t\t\t\t<pre>&lt;div class=\"container\"&gt;\n  &lt;div class=\"inner\"&gt;\n    &lt;div class=\"Hello\"&gt;Hello&lt;\/div&gt;\n  &lt;\/div&gt;\n  &lt;div class=\"inner\"&gt;\n    &lt;div class=\"Goodbye\"&gt;Goodbye&lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n<p><strong>Note:<\/strong> When passing a selector string to the <code>.wrapInner()<\/code> function, the expected input is well formed HTML with correctly closed tags. Examples of valid input include:<\/p>\n<pre>\n$(elem).wrapInner(\"&lt;div class='test' \/&gt;\");\n$(elem).wrapInner(\"&lt;div class='test'&gt;&lt;\/div&gt;\");\n$(elem).wrapInner(\"&lt;div class=\\\"test\\\"&gt;&lt;\/div&gt;\");\n<\/pre>\n","categories":["Manipulation > DOM Insertion"," Around","Version > Version 1.2","Version > Version 1.4"],"download":""}]
