How can I toggle between 2 images
jquery
Solution
A different maybe easier way to handle it:
http://jsfiddle.net/M9QBb/1/
$("#infoToggler").click(function() {
$(this).find('img').toggle();
});
<div id="infoToggler">
<img src="image1.png" width="60px" height="60px"/>
<img src="image2.png" width="60px" height="60px" style="display:none"/>
</div>
Problem
Im trying to use this code to toggle between a play and pause button but it doesn't seem to be working. How can I get it toggle between the 2 images when the are clicked http://jsfiddle.net/aFzG9/1/ ``` $("#infoToggler").click(function() { if($(this).html() == "<img src="http://tympanus.net/PausePlay/images/play.png" width="60px" height="60px"/>") { $(this).html("<img src="http://maraa.in/wp-content/uploads/2011/09/pause-in-times-of-conflict.png width="60px" height="60px"/>"); } else { $(this).html("<img src="http://tympanus.net/PausePlay/images/play.png" width="60px" height="60px"/>"); } }); ``` Thanks