What is the best way to determine, by looking through the DOM, whether an imagefield is empty?
Currently, I look for <div class='imagefield-preview'> to determine whether the imagefield is empty:

if ($(this).find('div.imagefield-preview')){
imagefield_is_empty = false;
} else {
imagefield_is_empty = true;
}

But I am wondering ... is there a better way?
Thanks.

Comments

quicksketch’s picture

This seems like a reasonable approach, though I think the way I'd go about it is by checking the FID stored in the hidden field (if it's greater than 0, there is a file).

kobnim’s picture

Thank you!!

quicksketch’s picture

Status: Active » Closed (fixed)