You’ve got some options.
Here’s one…
If you are using this component with the Material Design Standard Template I would:
- put the audio tags in the standardpage.html
- put the javascript function in the standardpage.html where all the other functions are
then add a button in the usual way and do
def button_1_click(self, **event_args):
self.call_js('PlaySound')
#do other stuff
Clone link
https://anvil.works/build#clone:AZZM4SXTC2WEEAQW=CL5LYUI3JUDBVJZEABURKH7D
if the button is a subform and Standardpage html is still the parent form then change:
self.call_js
to be js.call_js