I am trying to store the href value in the .mp3Logo div to a variable. I want to store it by clicking on a .startb. The value in musicLink is being stored as undefined. Why?
Javascript
$('.startb').click(function() {
var musicLink = $(this).siblings('.mp3Logo').attr('href');
});
HTML
<div class="audioContainer">
<div class="audioTitle"></div>
<div class="playerHolder">
<div class="startb" id="startb26" rel="Audio/004_IAM_God_is_Love.mp3"><img src="dbs/images/start.png" width="40" height="40" /></div>
<div class="flashObj" id="test26"></div>
<div class="mp3Logo"><a href="Audio/004_IAM_God_is_Love.mp3"><img src="dbs/images/mp3_off.gif"/></a></div>
</div>
</div>
The div does not have an
hrefattribute. You need to descend into the anchor.