'Would it be possible to create a "read more" button inside a Leaflet Marker Popup?

I'm currently working on a small project of mine. I've a map showcasing a few markers on them. It works so far, but i would like to be able to design a "show more" option on the markers pop-up to avoid bloating it with text and data.

Here's the marker's popup code:

let marker = L.marker([rivers[1].gps_latitude, rivers[1].gps_longitude]).addTo(map)
                marker.bindPopup("<b> Name:</b> " + rivers[1].name
                    + "<br><b> Latitude:</b> " + rivers[1].gps_latitude
                    + "<br><b> Longitude:</b> " + rivers[1].gps_longitude)

Would it be possible to create a "Read more" button that hide anything but the name variable fo the marker ? And only show Latitude and Longitude if you click on it ? I know how to create such things within a regular HTML page, but i've no idea how to implement it right into a pop-up.

Thanks for the help !



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source