Skip to content

Instantly share code, notes, and snippets.

@accidentallyc accidentallyc/$REQUIRE.js
Last active Aug 29, 2015

Embed
What would you like to do?
REQUIRE a dom to be retrieved via jQuery. Useful for keeping projects in tact specially when changes keep happening.
/* Assumes that jQuery has been loaded */
window.$REQUIRE = function(s){
var e = jQuery.apply(this,arguments);
if( e.length ) return e;
else throw "DOM " + s + " is required but cannot be found";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.