gabor aron gabor aron - 11 months ago 73
Javascript Question

How to get click event with javascript from an A-frame element

You can use

onclick= function();
in the HTML.

For example:
<a-box onclick="myFunction()"></a-box>

I want to get click event of cursor with javascript from an A-frame element, like a box for example, how can I do it?

Answer Source

If you are using the cursor component:

box.addEventListener('click', function (evt) { // ... });

If you want to use the mouse cursor, try