javascript - jQuery .text() not working with HTML -


with piece of code below:

if (params.showtooltip) {       map.label.text(mapdata.pathes[code].name);       jquery(params.container).trigger(labelshowevent, [map.label, code]);        if (!labelshowevent.isdefaultprevented()) {         map.label.show();         map.labelwidth = map.label.width();         map.labelheight = map.label.height();       } } 

i'm getting things in displayed label:

<strong>x name</strong><br>second line<br>third line 

what need in displayed label:

x name
second line
third line

i guess need convert parse map.label.txt html don´t know how it.

not 100% sure you're asking, try using .html() instead of .text().

.text() adds whatever string provide plain text inside html element, whereas .html() renders html elements within string.


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -