# How to display html content when clicking on object in three.js

**URL:** <https://discourse.threejs.org/t/how-to-display-html-content-when-clicking-on-object-in-three-js/7461>\
**Category:** Questions\
**Tags:** html-overlay, getting-started\
**Created:** [May 10, 2019, 3:06pm UTC](https://discourse.threejs.org/t/how-to-display-html-content-when-clicking-on-object-in-three-js/7461 "2019-05-10T15:06:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deevannagari\_Ajith](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/deevannagari_ajith/32/56162_2.png) [@Deevannagari\_Ajith](https://discourse.threejs.org/u/Deevannagari_Ajith)\
**Post date:** [May 10, 2019, 3:06pm UTC](https://discourse.threejs.org/t/how-to-display-html-content-when-clicking-on-object-in-three-js/7461/1 "2019-05-10T15:06:37Z")

</div>

I want Onclick event of threejs on 3d object to display html content(2d annotations) on screen…  
Please me out !!!

1.It is to display 2d annotations of 3d object after onclick…

Check this link for example: [https://deeajith.github.io/](https://deeajith.github.io/)  
I didn’t make it clickable so help me out,  
In that page there is a bogie I want information of each part of the bogie to be shown in HTML when we click on particular part of it. And also if there is a chance of storing the information on database how can it be done and connected to three js 3d objects.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [May 10, 2019, 4:27pm UTC](https://discourse.threejs.org/t/how-to-display-html-content-when-clicking-on-object-in-three-js/7461/2 "2019-05-10T16:27:28Z")

</div>

You can implement a basic 3D interaction with raycasting. This approach is demonstrated in the following official example: [three.js webgl - interactive cubes](https://threejs.org/examples/webgl_interactive_cubes)

Instead of `mouseMove` you have to add an event listener to the `click` event. In this way, you will find out whether an 3D object was clicked or not. You also get the exact intersection point that can be used to display a HTML based annotation. However, this point is usually in world space and needs to be converted to screen coordinates. The following post might help in this context:

> [@How to converting world coordinates to 2D mouse coordinates in ThreeJS](https://discourse.threejs.org/t/how-to-converting-world-coordinates-to-2d-mouse-coordinates-in-threejs/2251):
>
> i know how to converting 2D mouse coordinates to world coordinates,but whether the world coordinates convert into a 2D mouse coordinates if i know the world position ,uv,and the normal of the face.

---

<div class="post-metadata">

**Author:** ![Deevannagari\_Ajith](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/deevannagari_ajith/32/56162_2.png) [@Deevannagari\_Ajith](https://discourse.threejs.org/u/Deevannagari_Ajith)\
**Post date:** [May 12, 2019, 6:38pm UTC](https://discourse.threejs.org/t/how-to-display-html-content-when-clicking-on-object-in-three-js/7461/3 "2019-05-12T18:38:55Z")

</div>

Can you refer me some book or online course to learn threejs to advanced level.

Thank you .

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [May 12, 2019, 7:54pm UTC](https://discourse.threejs.org/t/how-to-display-html-content-when-clicking-on-object-in-three-js/7461/4 "2019-05-12T19:54:27Z")

</div>

Becoming an advanced `three.js` dev means you have a good understanding of the library AND computer graphics in general. You can find a lot of useful resources here:

> [@closed\_book three.js Bookshelf](https://discourse.threejs.org/t/three-js-bookshelf/2468):
>
> Feel free to add more resources/books to help the three.js community! [three.js Website](https://threejs.org/)[Documentation](https://threejs.org/docs/index.html)[Official Examples](https://threejs.org/examples/)[Scene Editor](https://threejs.org/editor/)[Github](https://github.com/mrdoob/three.js/)[Download Latest Release](https://github.com/mrdoob/three.js/archive/master.zip)[Release Log](https://github.com/mrdoob/three.js/releases)[Migration Guide](https://github.com/mrdoob/three.js/wiki/Migration-Guide)[Wiki](https://github.com/mrdoob/three.js/wiki)[Report a Bug/Request a Feature](https://github.com/mrdoob/three.js/issues/new)[NPM Package](https://www.npmjs.com/package/three) Community Portals [Official Discord](https://discordapp.com/invite/HF4UdyF)[Stackoverflow](https://stackoverflow.com/questions/tagged/three.js)[Twitter](https://twitter.com/threejs_org)[Slack](https://app.slack.com/client/T0AR9958A/C0AR9959Q)[Reddit](https://www.reddit.com/r/threejs/) Resources [Chrome Devtools extension](https://chrome.google.com/webstore/detail/threejs-developer-tools/ebpnegggocnnhleeicgljbedjkganaek)[Firefox Devtools extension](https://addons.mozilla.org/en-US/firefox/addon/three-js-developer-tools/)[spectorJS](https://spector.babylonjs.com/)[Discover three.js Tips and Tricks](https://discoverthreejs.com/tips-and-tricks/) Tutorials [Creating a Scene (from the three.js Docs)](https://threejs.org/docs/index.html?q=Geom#manual/introduction/Creating-a-scene) Books Not…

---

<div class="post-metadata">

**Author:** ![Deevannagari\_Ajith](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/deevannagari_ajith/32/56162_2.png) [@Deevannagari\_Ajith](https://discourse.threejs.org/u/Deevannagari_Ajith)\
**Post date:** [June 17, 2019, 6:58pm UTC](https://discourse.threejs.org/t/how-to-display-html-content-when-clicking-on-object-in-three-js/7461/5 "2019-06-17T18:58:21Z")

</div>

Thank you for support and referring content I need I’ve achieved what I want ✌😀  
I will be showcasing my project soon…🔜
