jQuery next() for class attr -
html code
<span class="play" href ="media/tagged - 357.mp3"> <span class="play" href ="media/tagged - 358.mp3"> <span class="play" href ="media/tagged - 359.mp3"> <span class="play" href ="media/tagged - 360.mp3">
i try set song player next/previous song buttons. possible next class attr href?
$("#fwd_btn").on('tap touch click',function () { if(themp3 !=undefined){ themp3.stop(); currentsong++; } url_new = $(".play").next().attr('href'); playsound(url_new); });
okay looking @ actual code, spans not have above. not siblings, inside of elements next() fail. plus not sure why span has href, better use data attribute.
second ran test
and shows finds element. unless currentsong not have correct value, not sure why not work.
what have in code $(this).find(".play")
means looking <button><span class="play" /></button>
know not have.
so how know active?
if there class
url_new = $(".play.active").next(".play").attr('href');
if there no class, use index
url_new = $(".play").eq(currentsong).attr('href'); // might need subtract 1 currentsong...
Comments
Post a Comment