Skip to content

Instantly share code, notes, and snippets.

@micmath
Created August 25, 2009 15:43
Show Gist options
  • Save micmath/174773 to your computer and use it in GitHub Desktop.
Save micmath/174773 to your computer and use it in GitHub Desktop.
var paras = $("p");
// all paras get object with cherry flavor
paras.data("desert", { flavor: "cherry" });
// modify flavor property of the first para
$(paras.get(0)).data("desert").flavor = "lime";
// see flavor property of the second para
console.log( $(paras.get(1)).data("desert").flavor ); // it's lime
// all paras get primitive value with size
paras.data("size", "grande");
// modify the size on the first para
$(paras.get(0)).data("size", "vente");
// see size property of the second para
console.log( $(paras.get(1)).data("size") ); // it's grande
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment