You could do this:

$('.highlight').removeClass('highlight').filter(':even').addClass('shaded');

The "this" keyword is useful only inside javascript code (it won't work in a
selector).

JK

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Jeff
Sent: Thursday, April 10, 2008 7:24 PM
To: jQuery (English)
Subject: [jQuery] "this" ?


'scuse me for the noob question here...

i have statements like this:

$(".highlight").removeClass;
$("this:even").addClass("shaded");

And I don't think I'm using "this" or :even correctly; it doesn't work
=)

Googling has turned up some different ways that the "this" keyword is
used, and I'm not sure what is right here. I'm just trying to remove a
class from a bunch of elements and then apply a new class to even
numbered elements.

Any ideas? Again, sorry for the dumb question, but googling the word
"this" isn't very helpful since you get like 10 kabillion results.

Reply via email to