我想要href值,但是这给了我未定义的,为什么呢?
var hy = $('.Player a.sc-player').attr('href');
console.log(hy);
<div id="Container">
<header>
<div id="Player">
<div class="Player">
<a href="https://soundcloud.com/rapzilla/andy-mineo-stop-the-traffic" class="sc-player"></a>
<p>hellow</p>
<a href="" class="download_song">Download</a>
</div>
</div>
<!--/Player-->
</header>**strong text**
答案 0 :(得分:0)
$(document).ready(function(){
alert($('.Player a.sc-player').attr('href'))
});