[jQuery] Re: setting attbitues

2007-04-19 Thread [EMAIL PROTECTED]
Thanks. That did it. - On Apr 19, 10:03 am, Jörn Zaefferer <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > I discovered that if I want to set the class for an object, this is > > not the code > > > $('#' + id).setAttribute("class", "myClass"); > > > What is the correct syntax? Tha

[jQuery] Re: setting attbitues

2007-04-19 Thread Jörn Zaefferer
[EMAIL PROTECTED] schrieb: I discovered that if I want to set the class for an object, this is not the code $('#' + id).setAttribute("class", "myClass"); What is the correct syntax? Thanks, - Dave Try this: $(...).attr("class", "myClass"); If you don't want to replace existing classes,

[jQuery] Re: setting attbitues

2007-04-19 Thread Brandon Aaron
You can use the addClass and removeClass methods to modify the class of the element. $('#'+id).addClass('myClass'); http://jquery.bassistance.de/api-browser/#addClassString http://jquery.bassistance.de/api-browser/#removeClassString -- Brandon Aaron On 4/19/07, [EMAIL PROTECTED] <[EMAIL PROTE