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.

I guess if there was a simple $("img").exists() then the if ()
statement would be a bit more intuitive.

Regards,

James

On Aug 22, 2:07 pm, MorningZ <[EMAIL PROTECTED]> wrote:
> a quick plugin to do a simple if statement?
>
> if ($(img).length > 0) {
>        $(img).doSomething();
>
> }

Reply via email to