Besides the bracket weidc mentioned, is your document valid?

I get the correct image width by using width() on both IE and FF.
Alternatively you can check for the offsetWidth attribute.

$('img').each(function(){
   alert(this.offsetWidth>500);
});

On Oct 29, 11:30 am, "Andy Matthews" <[EMAIL PROTECTED]>
wrote:
> I'm loading in a batch of images dynamically. Some of the images might not
> exist and I'm wondering how I might test for that image using jQuery
> (1.2.6). All I really want to do is to remove that img from the DOM so that
> it doesn't show on the page.
>
> I thought at first it would be simple enough to test the width of the image.
> All the valid images should be around 600 pixels wide, whereas the broken
> image should be 30 or so.
>
> I tried this:
>
> ${'img').each(function(){
>         alert( $(this).width() );
>
> });
>
> But I got 0 for both a valid, and invalid, image. Anyone have any ideas?
>
> andy

Reply via email to