What I'm trying to make is a input that when you type the song name it plays. First what I tried was
function myFunction() {
var id = document.getElementById("myInput").value;
var audio = 'https://bobzilla07.github.io/Music_Tap/' + id
var audio = new Audio ('audio');
audio.play();
with the html code of
<input id="myInput" type="text">
<button onclick="myFunction()">play</button>
Which didn't work
so I though what if I made it so
function myFunction() {
var id = document.getElementById("myInput").value;
var audio = new Audio 'https://bobzilla07.github.io/Music_Tap/' + id;
audio.play();
to which is still didn't work. Does anybody have any idea on how to fix it so it works?
Edit: Im not good with json or even know what im doing btu would there be a possibilty to get the input from
<input id="myInput" type="text"> <button onclick="myFunction()">play</button>
and put it in json to then call the audio from the link https://bobzilla07.github.io/Music_Tap/${song}.mp3 with ${song} being the input from the html input
let x = 1...new Audio('audio')which just passes in the string "audio", second one you havenew Audio 'https://...'which should throw a syntax error