I have an image and two buttons that are supposed to rotate the image either 45 or -45 degrees.
<div>
<img src="/assets/img1.png">
</div>
<div>
<button type="submit">rotate left 45</button>
<button type="submit">rotate right 45</button>
</div>
Is there a way to create a function that can apply a CSS transform rotate to this image? The rotation should occur in increments of 45 degrees in either direction, continuously rotating regardless of how many times the user clicks on the button.