> OK fair point. To me though:
>
> $("img").exists(function(matches) {
>
> });
>
> is a bit more of an elegant solution and a bit more readable (and
> saves you repeating the selector that might be quite long), but that's
> probably because $(img).length > 0 doesn't sound particularly
> intuitive to me.


Brandon's point is that the "if" is implicit.  You can do this
regardless of whether or not there are any images on the page:

$('img').doSomething();

Reply via email to