[jQuery] JQuery "exists" - anything in core or a plugin that does this?
Hi,
I can't seem to find anything that does the following:
$("img").exists(function(matches) {
/* do something with matches */
});
the difference between "exists" and "each" being it is only run once
and supplies all the matches as an argument.
The long-hand way of doing this is something along these lines:
var matches = $("img");
if (matches.length) {
/* do something */
}
Before I write myself a quick plugin, is there an obvious alternative
I've missed???
Regards,
James