Skip to content

Instantly share code, notes, and snippets.

@theconektd
Created February 17, 2011 09:14
Show Gist options
  • Save theconektd/831362 to your computer and use it in GitHub Desktop.
Save theconektd/831362 to your computer and use it in GitHub Desktop.
var $$ = function(param) {
var node = $(param)[0];
var id = $.data(node);
$.cache[id] = $.cache[id] || {};
$.cache[id].node = node;
return $.cache[id];
};
// Now, instead of doing $("#foo").data("foo") and ("#foo").data("foo", "bar"),
// you can do $$("#foo").foo and $$("#foo").foo = bar.
// from: http://yehudakatz.com/2009/04/20/evented-programming-with-jquery/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment