hello everyone !
I want to add an addEventListener to a button created within an Html Element.
HtmlElement:
<div style=" position: absolute; width: 100%; height: 100%; background-color: rgb(24, 55, 55); opacity: 0.95;">
<img src="https://media.tenor.com/On7kvXhzml4AAAAj/loading-gif.gif" alt="Loading GIF" style="max-width: 60px; max-height: 60px; margin-top: 15px; margin-left: 15px">
<p style="font-size: 20px; color: white; margin-top: -60px; margin-left: 115px; ">SEARCHING MATCH</p>
<button style="position: absolute; width:100px; height:25px; margin-top: -10px ;margin-left: 158px;" type="button">Cancelar</button>
</div>
var button= document.getElementById("mybtn5");
// Adiciona um ouvinte de evento para o clique no botão
button.addEventListener("click", function() {
alert("clicked");
});
is there any way to do this?