Skip to content

Instantly share code, notes, and snippets.

@uxDaniel
Last active December 17, 2015 01:28
Show Gist options
  • Save uxDaniel/5528244 to your computer and use it in GitHub Desktop.
Save uxDaniel/5528244 to your computer and use it in GitHub Desktop.
Logs in the console all the failed selectors passed to jQuery calls
//Override the $ function in order to log failed selectors
function $(arg) {
if ( jQuery(arg).length == 0) {
console.log(arg+" fails");
}
return jQuery(arg);
}
//Reassign all the attributes
for (var attrname in jQuery) { $[attrname] = jQuery[attrname]; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment