Hi,
I want to rotate image using JavaScript.
I have flower image, I want to rotate it by any degree.
Pls give sample
use CSS for the same
<img id="img" src="https://www.aspsnippets.com/Demos/SampleImages/lighthouse.jpg" alt="" /> <br /> <br /> <br /> <br /> <br /> <input type="button" onclick="RotateImage()" value="Rotate Image" /> <script> function RotateImage() { var img = document.getElementById("img"); var angle = 90; img.style.transform = "rotate(" + angle + "deg)"; }; </script>
Demo
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.