Answers for "how to mouse hover svg"

0

how to mouse hover svg

<svg width="500" height="500">

  <circle id="circle1" cx="50" cy="50" r="20" fill="red"/>
  <circle id="circle2" cx="150" cy="50" r="20" fill="green"/>

</svg>

...

document.getElementById('circle2').addEventListener('click', function(e) {
    e.currentTarget.setAttribute('fill', '#ff00cc');
});
Posted by: Guest on May-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language