Skip to content

Instantly share code, notes, and snippets.

@andyferra
Created February 17, 2011 09:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyferra/831362 to your computer and use it in GitHub Desktop.
Save andyferra/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