#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