I'm working on a Leaflet map, currently adding content to my popups. In .bindPopup ([" "]) is there any way to format a paragraph of writing on the backend into multiple lines of code within those quotes?

In other words, the following poem is one long quote—is there a way to format it into multiple lines so it's easier to organize headers, paragraphs, etc.)?

        .bindPopup("Three Rings for the Elven Lords under the Sky, Seven for the Dwarf Lords in their halls of Stone, Nine for Mortal Men doomed to die, One for the Dark Lord on his dark throne, In the Land of Mordor where the Shadows lie, One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them")
  • 4
    If you look at docs at leafletjs.com/reference-1.5.0.html#popup-option, you'll se that popup content cany be any HTML formated text. In your case just insert </br> tags at desired line break postions. – TomazicM Sep 7 at 11:07
  • Yeah I get what you're saying, and this might be a question more about writing HTML—on the back-end, how do I format the text in .bindPopup so it spans multiple lines, rather than one long line of text? – user186988 Sep 13 at 0:58
  • first line</br>second line</br>third line and so on – TomazicM Sep 13 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.