Return to Snippet

Revision: 26934
at May 17, 2010 07:13 by neal_grosskopf


Initial Code
//Store information
$("input").data("original", "$1.75");
$("input").data("currency", "$1.50");
$("input").data("decimal", 1.5);

//Retrieve information
$("input").data("original");
$("input").data("currency");
$("input").data("decimal");

//Shorthand store
$("input").data("numbers",{original: "$1.75", currency: "$1.50", decimal: 1.5});

//Shorthand retrieve
$("input").data("numbers").original;
$("input").data("numbers").currency;
$("input").data("numbers").decimal;

Initial URL
http://www.nealgrosskopf.com/tech/thread.php?pid=69

Initial Description
jQuery has a built in method that allows developers to store information inside elements. Learn how to use the .data() method and view some examples of how this can be used.

Initial Title
jQuery's .data() Method - Store Information Inside Elements

Initial Tags
jquery

Initial Language
jQuery