Skip to content

Instantly share code, notes, and snippets.

@kangax
Created December 15, 2008 18:07
Show Gist options
  • Select an option

  • Save kangax/36026 to your computer and use it in GitHub Desktop.

Select an option

Save kangax/36026 to your computer and use it in GitHub Desktop.
Element.addMethods({
store: function(element, key, value) {
if (!(element = $(element))) return;
var storage = element.getStorage();
if (Object.isUndefined(value)) {
for (var prop in key) {
storage.set(prop, key[prop]);
}
}
else {
storage.set(key, value);
}
return element;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment