<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet type='text/xsl' href='docs.xsl'?>
<docs>
<method cat='Core' type='function' short='Returns value at named data store for the element, as set by data(name, value).' name='data'>
<desc>If the jQuery collection references multiple elements, the value returned refers to the first element.

  This function is used to get stored data on an element without the risk of a circular reference. It uses jQuery.data and is new to version 1.2.3. It can be used for many reasons and jQuery UI uses it heavily.</desc>
<params type='String' name='name'>
  <desc>Name of the data stored.</desc>
</params>
<examples>
<desc>Get the data named "blah" stored at for an element.</desc>
<code>$("button").click(function(e) {
  var value;

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

  $("span").text("" + value);
});
</code>
</examples>
</method><method cat='Core' type='function' short='Stores the value in the named spot.' name='data'>
<desc>If the jQuery collection references multiple elements, the data element is set on all of them.This function can be useful for attaching data to elements without having to create a new expando.  It also isn't limited to a string.  The value can be any format.
  
  It may also be used for getting events attached to elements, however this is unsupported. First paramater being the element, second being the string "events"</desc>
<params type='String' name='name'>
  <desc>Name of data to store.</desc>
</params>
<params type='Any' name='value'>
  <desc>Value to be stored.</desc>
</params>
<examples>
<desc>Store then retrieve a value from the div element.</desc>
<code>$("div").data("test", { first: 16, last: "pizza!" });
$("span:first").text($("div").data("test").first);
$("span:last").text($("div").data("test").last);
</code>
</examples>
</method></docs>
