I have a URL that holds a "rel" attribute that needs to be passed to a jQuery function.
Here is the URL:
<a href="http://www.facebook.com/<?php echo $fblikeId; ?>" rel="<?php echo $fblikeId; ?>" ></a>
In a jQuery function I need to retrieve the value of the "rel" tag.
Here is the jQuery function:
jQuery(function($) {
$('#fblikes').advancedsocialstatus({
'displayId':'fblikes',
'service':'facebook',
'countof':'likes',
'userid': $(this).attr('rel'),
'callback':'formatCount'
});
});
The 'userid
' parameter of the above function needs to retrieve the value of the "rel
" tag. This above function then passes all that data onto a higher jQuery function which works fine.
What is the best way to retrieve the "rel" attribute of the link? Have tried using "$(this).attr('rel')
" but doesn't work.
The above function has multiple nodes. IE There may be multiple calls
jQuery(function($) {
$('#fblikes').advancedsocialstatus({
'displayId':'fblikes',
'service':'facebook',
'countof':'likes',
'userid':$(this).attr('rel'),
'callback':'formatCount'
});
$('#fbtalks').advancedsocialstatus({
'service':'facebook',
'countof':'talks',
'userid':'$(this).attr('rel')',
'callback':'formatCount'
});
});