Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
JQuery addClass() not working
Old 01-07-2011, 05:05 PM JQuery addClass() not working
The_Anomaly's Avatar
Extreme Talker

Posts: 216
Location: Boston, Ma
Trades: 0
I have a table with a class name of dataTable. This table also has TR's with a class of either primary or alternate. When someone mouses over a TR I want the background color to change. So i try using this, but it keeps telling me that .removeClass or addClass is not a function. What am I doing wrong?

$('table.dataTable tr').bind('mouseover',function(){this.removeClass( 'primary').removeClass('alternate').css("backgroun d-color", "999");}, false);
The_Anomaly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-07-2011, 06:09 PM Re: JQuery addClass() not working
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
"this" inside of an event refers to the raw DOM object, not jQuery. If you want it to return jQuery, you need to refer to it as $(this) or jQuery(this).
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 01-07-2011, 06:54 PM Re: JQuery addClass() not working
The_Anomaly's Avatar
Extreme Talker

Posts: 216
Location: Boston, Ma
Trades: 0
UGH! I swear I tried that and it didn't work! It seems to work now, thanks!
The_Anomaly is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to JQuery addClass() not working
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11232 seconds with 12 queries