Given the following markup:
<audio controls onclick="alert('hi')">
<source src="/url/track.mp3" type="audio/mpeg">
</audio>
I get no response from the onclick event. Seems like all the onclick events are bound to the player controls.
My goal is to run a separate function when the user hits "play".
The onplay attribute is what you're looking for.
<audio onplay="myFunction()">...</audio>
Here's some article on w3schools about it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With