I've got a button with an image inside that I want to swap when clicked. I got that part working, but now I also want it to change back to the original image when clicked again.
The code I'm using:
<button onClick=action();>click me<img src=images/image1.png width=16px id=ImageButton1></button>
And the Javascript:
function action() {
swapImage('images/image2.png');
};
var swapImage = function(src) {
document.getElementById(ImageButton1).src = src;
}
Thanks in advance!