Using Dom Element for Popup box

i want to create a DOM Popup Box with one Button which lets the whole box disappear when clicked.

I can’t find an example of how the button has to look like that it can be used from inside the game to do that.

right now the dom in the .js i looking like this:

  var element = this.add.dom(400, 300).createFromCache('smalldiv');

      element.on('click', function (event) {

       if ( === 'clickMe')
               //  Turn off the click events
               text.setText('Welcome ');

               //  Populate the text with whatever they typed in as the username!


the button in the html looks like this:

<p class="nomargin"> <button id="clickMe">

Use if ( === 'clickMe').

1 Like