Hi everyone, just wanna ask for some help on how to hide/disable or move the HTML after pressing any of the buttons, thank you in Advance PlayCanvas | HTML5 Game Engine
Hi @Genesis_Miranda,
It’s a bit difficult to say without knowing exactly how you want to achieve this. In general, when working with HTML UI, I would recommend adding an event listener to your buttons for the ‘click’ event and then using Element.remove()
in order to delete the desired HTML elements. You can find the documentation on Element.remove()
here:
I hope that’s helpful.
and press scene 1, I want to hide the HTML to show the activated scene
Hi @Genesis_Miranda,
I managed to find the editor link to your project here:
https://playcanvas.com/editor/scene/1535049
The project is a bit complex and the organization is rather messy, so I’m having trouble zeroing in on where you’re adding the HTML UI components to everything. I can give you some general advice though.
If I were creating something similar, I would define the HTML elements that I needed in a JS function in an accessible place and then create and attach the necessary nodes to the document as needed with Element.appendChild()
. Then, once a button is clicked, I would remove those specific elements using Element.remove()
in another easily accessible removal function. Whenever you need to add them back, you can easily do so with the function where you defined and added everything in the first place.
I hope that’s helpful.
do you have any sample I can look? thank you in advance