I am trying to rotate 2 images. For now, I have this code:
$('img').on({
'click': function () {
var src = ($(this).attr('src') === 'img1_on.jpg') ? 'img2_on.jpg' : 'img1_on.jpg';
$(this).attr('src', src);
}
});
It works perfectly: when I click on an image, the other appears. What I would like to do is exactly the same, but using a button to rotate the images, and not click on the image itself.
html
javascript/jquery
The script assumes that you have one single image on your page, to change for a specific image, do the following:
html
javascript/jquery