I'm new to CartoJS. When a user clicks a dot on my CartoDB map, I want the content of the infowindow to appear in a separate div on the web page.

How do I do this with CartoDB/JS?

1 Answer 1


You can use CARTO.js method addInfowindow(), as explained here (for more info here).

cdb.vis.Vis.addInfowindow(map object to add enable the infowindow, 
layer to enable infowindow, ['fields to get information'])

However, you can create custom infowindows with different tools (Moustache, HTML, underscore). Whatever choice you use, you would need to create a template first and then add the infowindow with the template. Here you have a working example using an HTML template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.