Hi Sid,

yeah, IE error messages are rarely helpful.

You might want to try using the .css() method for width and height, rather than the .attr() method:

$('#preview').livequery(function() {
        $('#preview')
                .attr('src',previewImage)
                .css({width: '302px', height: '188px'});
        return false;
});

Hope that helps.

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On May 20, 2008, at 1:01 AM, Sid wrote:


Hi,

I'm using the .attr() to set attributes of an img tag.

This works in Firefox 2.0.0.14 but not in Internet Explorer 7.

The offending piece of code is

$('#preview').livequery(function() {
        $('#preview').attr('src',previewImage);
        $('#preview').attr('width','302px');
        $('#preview').attr('height','188px');
        return false;
});

Works in FF but in IE, only the src is changed. The width and height
remain unaffected.
To see, check http://sid-deswal.110mb.com and click on 'Themes'

And I can't understand the IE error message which says

Line: 5
Char: 1
Error: Object Expected
Code: 0

Regards

Reply via email to