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

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -