user3837546
user3837546

Reputation: 93

Javascript popup with a table instead of just text (leafletjs example)

In this leafletjs quickstart guide, under the section titled "Working with popups", if you click the blue marker on the map, a popup shows up with the text "hello". Is it possible to have the popup contain, instead of just text, a table? Like a basic 1x2 html table that would be coded in HTML like this:

<table>
    <tr>
        <td>Cell 1</td>
        <td>Cell 2</td>
    </tr>

</table>

Upvotes: 3

Views: 5115

Answers (1)

pk.
pk.

Reputation: 986

Yes it is definitely possible for a popup to contain a table. I made a Fiddle with a simple test to show this and here's the bindPopup call I used.

layer.bindPopup("<table><tr><td>Cell 1</td><td>Cell 2</td></tr></table>");

Upvotes: 7

Related Questions