I have this:
HTML:
<div id="selectedsongs">
<a href="#" rel="1">song1></a>
<a href="#" rel="2">song2></a>
<a href="#" rel="3">song3></a>
</div>
Then:
selectedBtn = $('#selectedsong');
selectedBtn.click(function()
{
self.selectedsong($('a', this).attr('rel'));
return false;
});
But always takes the rel value of the first link, in this case, the value "1".
Why? :(
Thank you very much! ;-)
Do this instead :
<div id="selectedsongs">
<a href="#" rel="1">song1></a>
<a href="#" rel="2">song2></a>
<a href="#" rel="3">song3></a>
</div>
$('#selectedsongs a').click(function() {
alert($(this).attr('rel'));
});