Help with an Audio Source selector

I’ve got this audio source on my page for a in browser keyboard tester and the below audio plays when a key is pressed.

<audio id="myAudio"> <source src="click.wav"> </audio>

<script>var x = document.getElementById("myAudio"); function playAudio() { [x.play](https://x.play)(); } &#x200B;

I tried to make a drop down list to change the audio sound but cant seem to get it to work any help would be grateful :slight_smile:

<select id="selection"> <option value="">(None)</option> <option value="click.wav">Click</option> <option value="quack.mp3">Quack</option> </select>

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.