0
const insertIntoDom = (valor) => {
const li = document.createElement('li')
li.innerHTML = `<p>${valor}</p><button type="submit" class="lyrics-btn" onClick="lyrics(${campoBusca.value}, ${valor})">lyrics</button>`
resultadoUL.append(li)
}
The function insertIntoDom
above takes a string as parameter. Inside the li
, through the onclick
, the function lyrics
is called and the two parameters within it are also strings.
It turns out that by clicking the button lyrics
I get the following message on the console:
Uncaught SyntaxError: missing ) after argument list.
The function lyrics
down below:
const lyrics = async (cantor, nomeMusica) => {
try{
const res2 = await fetch(`${url1}/v1/${cantor}/${nomeMusica}`)
const musicas = await res2.json()
console.log(musicas)
}catch (error) {
console.log(error)
}
}
Can someone help me?