How to use sibling combinator together with `:scope` in `querySelector`
Let’s say I have an element and I want to select the next matching sibling. Normally, in css I’d be able to write <some selector for this element> ~ <selector for sibling>
, but the sibling combinators (~
and +
) don’t seem to work when applied inside querySelector
with the :scope
pseudo-selector.
Use wildcards to trace an a.href in the querySelectorAll NodeList
Let’s say that instead of looking at the ID, I want to select all a.href
elements that contain (a piece of) this example: if document.url
is "www.youtube.com"
.
use wildcards to trace a a.href in querySelectorAll nodelist
Let’s say that instead of looking at the ID, I want to select all a.href that contain (a piece of) this example document.url “www.youtube.com”