Skip to content

Instantly share code, notes, and snippets.

@josefglatz
Created August 5, 2014 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josefglatz/ab3c47aa42c289cb48e9 to your computer and use it in GitHub Desktop.
Save josefglatz/ab3c47aa42c289cb48e9 to your computer and use it in GitHub Desktop.
jQuery tiny "exists" plugin
/*
* if exists method - a tiny jquery plugin <3
* by Josef Florian Glatz <jousch@gmail.com>
*
*/
$.fn.exists = function(callback) {
var args = [].slice.call(arguments, 1);
if (this.length) {
callback.call(this, args);
}
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment