3 ms·
sweet! but alas, I'm looking through the examples and one line of simple+clear JQuery is a often a dozen tricky lines of pure CSS.
by asah 3y ago
sweet! but alas, I'm looking through the examples and one line of simple+clear JQuery is a often a dozen tricky lines of pure CSS.
- divbzero 3y agoI usually take it as suggestive code that you don’t have to use verbatim. For example, You might not need jQuery offers the following suggestions: // toggle visibility function toggle(el) { if (el.style.display == 'none') { el.style.display = ''; } else { el.style.display = 'none'; } } // remove multiple elements for (const el of document.querySelectorAll(selector)) { el.remove(); } While the following would be more concise: // toggle visibility function toggle(el) { el.style.display = el.style.display === 'none' ? '' : 'none; } // remove multiple elements document.querySelectorAll(selector).forEach(el => el.remove());