the murmurous sea

DOM: Node.nodeValue 본문

#dev/개념정리

DOM: Node.nodeValue

lunacer 2020. 5. 5. 11:03

1. property of the Node interface.
2. returns or sets the value of the current node.

3. If the node is an element node, the nodeValue property will return null.

    : 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.childNodes[0].nodeValue).
4. An alternative to the nodeValue property can be the textContent property.

[Syntax]

Return the node value:

node.nodeValue

Set the node value:

node.nodeValue = value

 

[Return Value]

: A String, representing the value of the node.
: Possible values

Returns
null for element nodes and document nodes
the value of the attribute for attribute nodes
the content for text nodes
for comment nodes

 


https://www.w3schools.com/jsref/prop_node_nodevalue.asp
https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue

 

 

'#dev > 개념정리' 카테고리의 다른 글

DOM: HTMLElement.innerText  (0) 2020.05.05
DOM: Node.textContent  (0) 2020.05.05
DOM: nodeValue vs. textConent vs. innerText vs. innerHTML  (0) 2020.05.04
JS ES1: slice()  (0) 2020.05.04
JS, ES1: splice()  (0) 2020.05.04
Comments