I try to replace the .not()
function of jQuery with a native way and unfortunately my use case with document.querySelectorAll
is not working.
This is what I want to achieve - changing the jQuery selector to vanilla JS:
$('#someID').not('.classNameOne > div, .classNameTwo > div, div[class*="-something"] > div')
What I tried is using plain and simple this selector:
document.querySelectorAll("#someID:not(.classNameOne > div, .classNameTwo > div, div[class*="-something"] > div)");
This throws this error:
Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document': '#someID:not(.classNameOne > div, .classNameTwo > div, div[class*="-something"] > div)' is not a valid selector.
at <anonymous>:1:10
Does one of you know a better way to replace this jQuery function?
Thanks!