Created
May 22, 2017 01:44
-
-
Save suplo/acfbb39525a3c387b062c8f97a7e5ac6 to your computer and use it in GitHub Desktop.
innerText vs innerHTML, textContent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`<p id="test"> This element contains <span>an inner span</span>. </p>` | |
The values of these properties of the "test" paragraph will be: | |
* innerText: "This element contains an inner span." :point_left: Just the text, trimmed and space-collapsed. | |
* innerHtml: " This element contains <span>an inner span</span>. " :point_left: All spacing and inner element tags. | |
* textContent: " This element contains an inner span. " :point_left: Spacing, but no tags. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment