Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Jquery, getting more than one id in a function
Index -> Programming, PHP -> PHP Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nonamedude




PostPosted: Mon May 16, 2011 10:13 am   Post subject: Jquery, getting more than one id in a function

Hey guys, I seemed to have run into a roadblock.

When I am in a function, is it possible to get more that one id. Here is the code I have right now

code:
$('a.commentUp').bind('click',function()
                {
                    var myid = $(this).attr('id');     //first call
 var myid2 = $('a.common').attr('id2'); //second call   
}


When I do the second call I get an undefined value if I print it out. The first value is fine.

This is what I am trying to get the value of

code:
<a id = $storyID class = 'common'>


This is what the value that works (the first call)

code:
<a id = $commentNumber class = 'commentUp'>
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Mon May 16, 2011 11:08 am   Post subject: RE:Jquery, getting more than one id in a function

Look at the difference between these two very carefully.
.attr('id2')
<a id = $storyID

And remember the markup is as follows:
<tag attribute=value attribute=value>

The .attr() function returns the value of the attribute entered as a parameter.
nonamedude




PostPosted: Thu May 19, 2011 5:14 pm   Post subject: Re: Jquery, getting more than one id in a function

Oh thanks, i see my mistake
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: