Update hide.md
This commit is contained in:
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
Hides all the elements specified.
|
Hides all the elements specified.
|
||||||
|
|
||||||
Use `Array.forEach()` to apply `display: none` to each element specified.
|
Use `NodeList.prototype.forEach()` to apply `display: none` to each element specified.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const hide = els => els.forEach(e => e.style.display = 'none');
|
const hide = els => els.forEach(e => e.style.display = 'none');
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
hide(...document.querySelectorAll('img')); // Hides all <img> elements on the page
|
hide(document.querySelectorAll('img')); // Hides all <img> elements on the page
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user