I have a list of songs that have play buttons attached to them. With the code below, I am able to switch the "play" button to "pause" when clicked and if another "play" link is clicked the original song switches back to "Play" and the newly clicked track shows "Pause" as it should.
HOWEVER, when I click a track that is playing and the button changes to "Pause", pressing it again doesn't switch it back to "Play".
Basically I would like the image to toggle on click and if another button is pushed the first button reverts back to it's original state.
Any help would be greatly appreciated!
$(function() {
$('.play').click(function () {
$('.play').css('background-image', 'url(My Play Button URL)');
$(this).css('background-image', 'url(My Pause Button URL)');
});
});