the murmurous sea

DOM: HTMLElement.innerText 본문

#dev/개념정리

DOM: HTMLElement.innerText

lunacer 2020. 5. 5. 11:24

1. The innerText property of the HTMLElement.
2. represents the "rendered" text content.
   : it approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied.
3. sets or returns the text content of the specified node, and all its descendants.
4. set the innerText, any child nodes are removed and replaced by a single Text node containing the specified string.
5. As a getter, it approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied it to the clipboard.

 

[Syntax]

Return the text content of a node:

node.innerText

Set the text content of a node:

node.innerText = text

 

[Return Value]

1. A String, representing the "rendered" text content of a node and all its descendants
2. A DOMString representing the rendered text content of an element. If the element itself is not being rendered (e.g detached from the document or is hidden from view), the returned value is the same as the Node.textContent property.

 


https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText

https://www.w3schools.com/jsref/prop_node_innertext.asp

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

Object literal (empty)  (0) 2020.05.12
DOM: Element.innerHTML  (0) 2020.05.05
DOM: Node.textContent  (0) 2020.05.05
DOM: Node.nodeValue  (0) 2020.05.05
DOM: nodeValue vs. textConent vs. innerText vs. innerHTML  (0) 2020.05.04
Comments