I'm trying to insert a value that I'm getting from the url inside the HTML attribute, as follows:
I've done this function
function urlId() {
document.getElementsByTagName("BUTTON")[0].setAttribute("data-channel-external-id", "qs.id");
}
I want to insert the value of this variable qs.id
( qs.id
is the variable of a function that I did to get a value from the ex url: meusite.com/pagina.php?id=VALOR que I want to get and set the HTML attribute .
So I made this code above and I put the following in my data-channel-external-id="urlId()"
attribute but it is not working ...