You should use the css method, not the attr method.

...).children('div').css('width', 80);

You can also pass and object of name value pairs.

...)children('div').css({ width: 80 });

No need to add the 'px' as jQuery will do it for you.

--
Brandon Aaron

On 5/22/07, SamCKayak <[EMAIL PROTECTED]> wrote:

I'm setting the width of a DIV using:

...).children('div').attr( {width: ('80px'} );

It seems to have no effect (I have margin:0 auto; set in CSS).

The rendered (view/generated source) shows:

<div width="80">

which isn't what I had expected.  I know that:

<div style="width:80px">

will work fine.

Is there a better way to set the width of a block element?

Sam


Reply via email to