Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1363 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

jQuery: Selecting clicked element?

Thread title: jQuery: Selecting clicked element?
Reply    
    Thread tools Search this thread Display Modes  
06-26-2012, 01:48 AM
#1
Eirik-M is offline Eirik-M
Status: Member
Join date: Apr 2008
Location:
Expertise: Design
Software: Photoshop
 
Posts: 162
iTrader: 0 / 0%
 

Eirik-M is on a distinguished road

  Old

Originally Posted by Dan View Post
console.log is spitting "Object 7 has no method."

Meh. Guess I'll be re-reading documentation tonight.

I believe the problem is this. You declare index as

Code:
var index = $(this).index();
This is an integer, not an object. Therefore this fails (the integer has no method called "addClass"):

Code:
index.addClass("fave");
I believe this is what you want:

Code:
$(this).addClass("fave");

Reply    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed