I want to append the text <b>text</b>
to an element as a child without changing it into HTML.
append('<b>text</b>')
gives bold content text
, but I want the text to be <b>text</b>
.
I want to append the text <b>text</b>
to an element as a child without changing it into HTML.
append('<b>text</b>')
gives bold content text
, but I want the text to be <b>text</b>
.
Append a text node:
.append(document.createTextNode('<b>text</b>'));
You have to mix up native js to accomplish this,
var node = document.createTextNode("<b>test</b>");
$('element')[0].appendChild(node);