Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting nodeValue of text node in Javascript when string contains html entities

Tags:

People also ask

What does nodeValue do in JavaScript?

The nodeValue property of the Node interface returns or sets the value of the current node.

Which of the following properties can you use to set the content of a text node?

Use the textContent property to return the concatenation of the textContent of every child node. You can use it to set a text for a node.

What is the difference between nodeValue and value in JavaScript?

The value of an input element is available from its value property. nodeValue is a property of all DOM nodes, and not relevant to input elements.

What is nodeValue in html?

Definition and UsageThe nodeValue property sets or returns the value of a node. If the node is an element node, the nodeValue property will return null. Note: If you want to return the text of an element, remember that text is always inside a Text node, and you will have to return the Text node's node value (element.


When I set a value of a text node with

node.nodeValue="string with &#xxxx; sort of characters"

ampersand gets escaped. Is there an easy way to do this?