[jQuery] .css, jQuery1.1

2007-01-15 Thread Bruce MacKay

Hello folks,

I'm having difficulty understanding how .css is supposed to work.

The following line of code correctly styles the font color of the 
json data within #tree as blue:


$(#tree).highlightFade({color:'red',speed:2000,iterator:'sinusoidal'}).html(field.msg).css({color: 
blue});


However, attempting to also style the font size or text alignment 
throws an error.


$(#tree).highlightFade({color:'red',speed:2000,iterator:'sinusoidal'}).html(field.msg).css({color: 
blue, font-size: 1.2em, text-align: left});


Yet, the structure I'm using is as per the 1.1 API (as far as I can 
see), so obviously there is something else I'm missing here.  Can 
anyone help please?


Thanks,

Bruce ___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] .css, jQuery1.1

2007-01-15 Thread John Resig
The problem is that JavaScript keywords/variables cannot contain a '-' in them.

You have two options:
.css({color: blue, fontSize: 1.2em, textAlign: left});

or:
.css({color: blue, font-size: 1.2em, text-align: left});

--John

On 1/15/07, Bruce MacKay [EMAIL PROTECTED] wrote:

  Hello folks,

  I'm having difficulty understanding how .css is supposed to work.

  The following line of code correctly styles the font color of the json data
 within #tree as blue:

 $(#tree).highlightFade({color:'red',speed:2000,iterator:'sinusoidal'}).html(field.msg).css({color:
 blue});

  However, attempting to also style the font size or text alignment throws an
 error.

 $(#tree).highlightFade({color:'red',speed:2000,iterator:'sinusoidal'}).html(field.msg).css({color:
 blue, font-size: 1.2em, text-align: left});

  Yet, the structure I'm using is as per the 1.1 API (as far as I can see),
 so obviously there is something else I'm missing here.  Can anyone help
 please?

  Thanks,

  Bruce
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/