Today I Learned - Rocky Kev

TIL Using pseudo-classes in your querySelector!

POSTED ON:

TAGS:

I didn't know this, but you can use pseudo-classes in your querySelector!

Let’s say you want to ignore buttons with the .tuna class. You can use the :not() pseudo-class in your selector string, like this…

let notTuna = document.querySelectorAll('.sandwich:not(.tuna)');

via


Related TILs

Tagged:

TIL the alternate keyword

If 'alternate' appears along with the stylesheet keyword, the linked file is an alternative stylesheet. It won’t be applied to the document, but it will be ready for when we need it.

TIL Logical Properties

For that sweet sweet Internationalization you want to avoid directional words like 'left', 'right', 'top', and 'bottom'.

TIL Using pseudo-classes in your querySelector!

let notTuna = document.querySelectorAll('.sandwich:not(.tuna)')