Files
30-seconds-of-code/snippets/hide.md
30secondsofcode 37fbde0d4f Travis build: 283
2018-08-29 21:11:17 +00:00

300 B

hide

Hides all the elements specified.

Use NodeList.prototype.forEach() to apply display: none to each element specified.

const hide = els => els.forEach(e => (e.style.display = 'none'));
hide(document.querySelectorAll('img')); // Hides all <img> elements on the page