Skip to content

Triggering Custom Javascript on Feature Click in Choropleth Maps #119

Answered by jereze
jereze asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for your response.

I don't operate within Observable notebooks, but your insight provided a hint on how to achieve my goal.

Here's the solution I came up with:

document.getElementById('bertinmap').addEventListener('click', (event) => {
    console.log(event.target.__data__.properties)
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jereze
Comment options

Answer selected by jereze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants