...
` and replace it by `...
`. In the outer document we can see the new content instead of the ``. But the old `div` variable is still the same.
The `outerHTML` assignment does not modify the DOM element, but extracts it from the outer context and inserts a new piece of HTML instead of it.
Novice developers sometimes make an error here: they modify `div.outerHTML` and then continue to work with `div` as if it had the new content in it.
That's possible with `innerHTML`, but not with `outerHTML`.
We can write to `outerHTML`, but should keep in mind that it doesn't change the element we're writing to. It creates the new content on its place instead. We can get a reference to new elements by querying DOM.
## nodeValue/data: text node content
The `innerHTML` property is only valid for element nodes.
Other node types have their counterpart: `nodeValue` and `data` properties. These two are almost the same for practical use, there are only minor specification differences. So we'll use `data`, because it's shorter.
We can read it, like this:
```html run height="50"
Hello
```
For text nodes we can imagine a reason to read or modify them, but why comments? Usually, they are not interesting at all, but sometimes developers embed information into HTML in them, like this:
```html
Welcome, Admin!
```
...Then JavaScript can read it and process embedded instructions.
## textContent: pure text
The `textContent` provides access to the *text* inside the element: only text, minus all `
`.
For instance:
```html run
Headline!
Martians attack people!
```
As we can see, only text is returned, as if all `` were cut out, but the text in them remained.
In practice, reading such text is rarely needed.
**Writing to `textContent` is much more useful, because it allows to write text the "safe way".**
Let's say we have an arbitrary string, for instance entered by a user, and want to show it.
- With `innerHTML` we'll have it inserted "as HTML", with all HTML tags.
- With `textContent` we'll have it inserted "as text", all symbols are treated literally.
Compare the two:
```html run
```
1. The first `` gets the name "as HTML": all tags become tags, so we see the bold name.
2. The second `
` gets the name "as text", so we literally see `
Winnie-the-pooh!`.
In most cases, we expect the text from a user, and want to treat it as text. We don't want unexpected HTML in our site. An assignment to `textContent` does exactly that.
## The "hidden" property
The "hidden" attribute and the DOM property specifies whether the element is visible or not.
We can use it in HTML or assign using JavaScript, like this:
```html run height="80"
Both divs below are hidden
With the attribute "hidden"
JavaScript assigned the property "hidden"
```
Technically, `hidden` works the same as `style="display:none"`. But it's shorter to write.
Here's a blinking element:
```html run height=50
A blinking element
```
## More properties
DOM elements also have additional properties, many of them provided by the class:
- `value` -- the value for `
`, `