Reputation: 632
How do I set a .click() event in this SVG? To click automatically.
<span style="margin-right: 15px;" id="play">
<svg class="speechace-playback-30" aria-label="Start playing example audio" aria-pressed="false" role="button" viewBox="0 0 30 30" tabindex="0" style="position: relative; cursor: pointer; vertical-align: middle; outline: 0px;">
<circle cx="15" cy="15" r="14" style="fill: rgb(69, 97, 26); stroke: rgb(69, 97, 26); stroke-width: 1;"></circle>
<path d="M19.5,15 L12.75,11.102885682970026 L12.749999999999998,18.897114317029974 z" style="stroke: rgb(255, 255, 255); stroke-width: 1; fill: rgb(255, 255, 255); stroke-linecap: round; stroke-linejoin: round;"></path>
</svg>
</span>
Upvotes: 1
Views: 330
Reputation: 52
write this in your js code. Try to cover svg with div tag
document.getElementById("IdOfYourSvg").addEventListener("click",(event)=>{
//your logic
})
Upvotes: 1