Files
30-seconds-of-code/snippets/hide.md
Isabelle Viktoria Maciohsek 27c168ce55 Bake date into snippets
2021-06-13 13:55:00 +03:00

424 B

title, tags, firstSeen, lastUpdated
title tags firstSeen lastUpdated
hide browser,css,beginner 2017-12-28T23:33:21+02:00 2020-09-15T16:28:04+03:00

Hides all the elements specified.

  • Use NodeList.prototype.forEach() to apply display: none to each element specified.
const hide = (...el) => [...el].forEach(e => (e.style.display = 'none'));
hide(document.querySelectorAll('img')); // Hides all <img> elements on the page