stefanocudini / leaflet-search

Search stuff in a Leaflet map
https://opengeo.tech/maps/leaflet-search/
MIT License
772 stars 334 forks source link

HTML in search result #316

Closed hupe13 closed 1 year ago

hupe13 commented 1 year ago

Assume, the search result is <a href="https://any/url">My Result</a>. The tooltip shows it correct: "My Result". When I hit enter, the search field contains: "<a href="https://any/url">My Result</a>" How do I get the result as interpreted html? Where can I strip out the HTML tags?

Thank you very much.

hupe13 commented 1 year ago

Solved with

                leafextsearch=leafextsearch.replace( /<p>/ig, ' ');
                leafextsearch=leafextsearch.replace( /<br>/ig, ' ');
                leafextsearch=leafextsearch.replace( /(<([^>]+)>)/ig,'');
                leafextsearch=leafextsearch.replace( / \| /g, '');
                leafextsearch=leafextsearch.replace( / +/g, ' ');