How can I start playing music by clicking on widget?

Hello, in my graduation work I need to turn on music by clicking on the widget.

I tried to write the code, but it didn’t work out, I’m upset. Is it even possible?

I could leave you a small donation for your help…

HI @_442002 I would suggest sharing the code you have! But here i’ve attached an example.


<script src="https://code.jquery.com/jquery-3.6.1.js"></script>

<script>
var audioNAMEHERE = document.createElement('audio');
audioNAMEHERE.setAttribute('src', 'YOUR-AUDIO-URL-HERE');
audioNAMEHERE.addEventListener("load", function() {
  audioNAMEHERE.play();
}, true);

$('[READYMAG DATA ID HERE]').click(function() {
  audioNAMEHERE.play();
});
</script>
1 Like

Hello, thank you SO much for the answer, I just saw it now. I don’t understand your code well, but I did everything as indicated in your comments: I added a link to the sound and found the ID of my standard shape‐widget readymag, BUT nothing worked for me. nothing happens by click, please poke me in my the error. Thank you dear!

thank you very much, I got everything, I had to replace the numbers with words