To check if an element has a particular class: $(...).is('.theClass');
To add a class to an element: $(...).addClass('theClass');
To remove a class: $(...).removeClass('theClass');

See also:
http://docs.jquery.com/Traversing/is#expr
http://docs.jquery.com/Attributes/addClass#class
http://docs.jquery.com/Attributes/removeClass#class
http://docs.jquery.com/Attributes/toggleClass#class

See if those help. Good luck.

--Erik


On 12/1/07, Gordan <[EMAIL PROTECTED]> wrote:
>
>
> I'm loosing my mind over this :-(
> http://www.writesomething.net/users/ ("show classical users list"
> link)
> I have a few lines of code which are extremly simple and work as
> expected in FF, but IE is refusing to cooperate :-(
> I tried literally everything but it just returns the "expected
> identifier, string or number" error.
> Please help, this has to be some simple bug that I'm overseeing :-
> ( thank you
> here's the complete code, and I use the latest 1.2.1 jQuery: (IE says
> that the error is on the 3rd line)
>
> function change_users_display() {
> if ($('#users').attr('class') == 'users_cloud') {
> $('#users').attr({class: ''});
> $('#change_users_display_classical').show();
> $('#change_users_display_cloud').hide();
> } else {
> $('#users').attr({class: 'users_cloud'});
> $('#change_users_display_classical').hide();
> $('#change_users_display_cloud').show(); }
> return true; }
>

Reply via email to