Get value out from HTML with mapbox gl

I want to get the current center(zoomed in the viewport) of a mapbox HTML element which I have created using mapbox js gl.
Below is the screenshot of how i have created the JS function to get map center inside the mapbox HTML element.

This is function created is bubble_fn_a, below is the screenshot of javascript to bubble element settings

I have then create a button which when pressed creates the run javascript function, as shown below

I am not getting any value out of this.

Can someone please help me decode this issue?

Also, the more context you provide with your questions (screenshots, link to an open app, etc.), the more likely you’ll get good help quickly :slight_smile:

This topic was automatically closed after 70 days. New replies are no longer allowed.