Skip to content

Instantly share code, notes, and snippets.

@gbakernet
Created September 27, 2010 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gbakernet/598465 to your computer and use it in GitHub Desktop.
Save gbakernet/598465 to your computer and use it in GitHub Desktop.
//For use on the jquery functions that except selectors
jQuery.fn.atLeastOne = function(prop, selectorsArr) {
var ret = 0, self = this,
testSelector = function(value){
return self[prop].apply(self, [value]).size() > 0;
};
$.each(selectorsArr, function(i, value){
ret = testSelector(value);
// break loop if found
if(ret) { return false }
})
return ret;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment