I have a play button, along with a forward button.
The HTML is thus:
<div id="control">
<a href="#" id="pause"></a>
<a href="#" id="next"></a>
</div>
What I want is when someone clicks pause, a play icon comes up, and when they click play, the pause icon comes up again. Now this can be done with toggle, but I also need the play icon to come up when someone clicks next, and the pause icon to come up when they click on the play icon. Toggle does not work for this.
Here is my jQuery, and obviously, because of the nature of javascript, this doesn't work. (The added attribute play is not recognized)
What is a good solution for what I'm trying to do?
// Play/pause is clicked, alternate between starting and stopping the interval
$('#pause').click(function(event) {
$(this).css("background-image", "url(../images/controls_play.png)");
$(this).attr('id', 'play');
});
$('#play').click(function(event) {
$(this).css("background-image", "url(../images/controls_pause.png)");
$(this).attr('id', 'pause');
});
$('#next').click(function(event) {
$('#pause').css("background-image", "url(../images/controls_play.png)");
$('#pause').attr('id', 'play');
});