我设置了一个音乐页面,当单击歌曲的播放按钮时,课程从buttons_mp3j
变为buttons_mp3jpause
。当类为buttons_mp3jpause
时,我想定位其父li.song
级并向其添加一个类。
<li class="song">
<div>
<span>
<span class="buttons_mp3jpause">
</span>
</span>
</div>
</li>
我已经尝试了以下代码,但它没有工作。
$(".buttons_mp3jpause").parents("li.song").addClass("playing");
我哪里做错了?
编辑
$('.haiku-play').bind('click', function() {
$('.haiku-player').jPlayer("pause");
})
编辑 2
<article>
<ul>
<li class="song">yadayada</li>
<li class="song">yadayada</li>
<li class="song">yadayada</li>
<li class="song">yadayada</li>
</ul>
</article>
<article>
<ul>
<li class="song">yadayada</li>
<li class="song">yadayada</li>
<li class="song">yadayada</li>
<li class="song">yadayada</li>
</ul>
</article>
<article>
<ul>
<li class="song">yadayada</li>
<li class="song">yadayada</li>
<li class="song">yadayada</li>
<li class="song">yadayada</li>
</ul>
</article>