how can i handle HtmlElement button click ?

0 favourites
  • 1 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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>
    

    script :

    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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)