I would like to make a sound after clicking on a button and opening a modal window, I would be grateful for help, no form data is sent to the server, this is just a visual improvement, like clicking on the submit button and the sound of sending a message or email
<button class="rent-yacht-send-button" type="submit" data-modal-open>
Send<svg class="send-arrows-icon" width="18" height="8">
<use href="../img/icons.svg#icon-arrow-right"></use>
</svg>
</button>
</form>
</div>
<!-- Modal window -->
<div class="backdrop is-hidden" data-modal>
<div class="modal-window">
<button class="modal-btn" type="button" data-modal-close>
<svg class="icon-modal" width="24" height="24">
<use href="../img/icons.svg#icon-close-modal"></use>
</svg>
</button>
<picture>
<source media="(min-width:768px)" srcset="./img/rent/[email protected] 1x, ./img/rent/[email protected] 2x" />
<source
media="(min-width:320px)"
srcset="./img/rent/[email protected] 1x, ./img/rent/[email protected] 2x"
/>
<img src="./img/rent/[email protected]" alt="Thanks for confirming your order" class="modal-image" />
</picture>
<h3 class="modal-heading">Thank You</h3>
<p class="modal-p"
>Thank you for choosing Yacht Adventures, your booking details have been received and our team will be in
touch shortly to confirm your reservation and provide any additional information or assistance you may
need.</p
>
</div>
</div>
I found several scripts but they work crookedly, or do not perform their function at all
3
Answers
you can use this code : Jsfiddle
Add an audio tag and set the audio url to it’s src value. Then
The OP is missing the required JavaScript, plus the HTML is incomplete — there’s no
<form>
tag, only the end tag</form>
. Normally I’d leave a comment, but I’m bored. Details are commented in example below.