[jQuery] [Fwd: this.addClass("foo")??]
I figured it out. Use $(this) to convert 'this' to a jQuery object.
-------- Original Message --------
Subject: this.addClass("foo")??
Date: Fri, 08 Dec 2006 17:40:26 +0000
From: Peter Bengtsson <peter@fry-it.com>
To: jQuery Discussion. <discuss@jquery.com>
Here's the code that doesn't work. Can someone point me in the right
direction?
$(function(){
$("span.tagvalue").click(function() {
// ...do other stuff...
// add "clicked" as class now that it's been clicked
this.addClass("clicked"); // THIS DOESN'T WORK
});
});
This doesn't work because 'this' is not a jQuery object I guess. How
sould I do this then?
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/