I have a counter in my scene, using this code here: A-frame score counter with multiple objects
The object the user are clicking are are not visible (they are trying to guess where objects are in the scene). I would like them to become visible once they are clicked on.
I'm not sure how to get the item id from evt.target to change ('visible', true). Is there a way to get the id from evt.target so I can use document.querySelector? Or is there a better way to do this?
You don't have to use the querySelector, the evt.target
already has a valid reference to the clicked element:
this.el.addEventListener("click", (e)=>{
e.target.setAttribute("visible", "true")
})
live fiddle here.