Update hide.md

This commit is contained in:
Felix Wu
2018-08-29 23:08:11 +02:00
committed by GitHub
parent e35cb76b66
commit d217716ccc

View File

@ -2,12 +2,12 @@
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
const hide = els => els.forEach(e => e.style.display = 'none');
```
```js
hide(...document.querySelectorAll('img')); // Hides all <img> elements on the page
hide(document.querySelectorAll('img')); // Hides all <img> elements on the page
```