Hey! This content applies only to previous CARTO products

Please check if it's relevant to your use case. On October 2021 we released a new version of our platform.
You can learn more and read the latest documentation at docs.carto.com

Questions  /  Building Maps  /  Development

How can I open a popup when clicking on a button with CARTO.js?

Learn how to assign a open popup action to a button in a CARTO.js application.

This simple example shows how to open CARTO.js popup when clicking on an HTML element such as a button. Basically, it uses the SQL API using Axios to get the coordinates and other thematic information, and opens a Leaflet popup displaying that data as content.