How to delete a specific class from querySelectorAll?

2

I'm working on a project where I use bootstrap modals, due to a problem of overlapping some elements, I needed to use a script that always assigns the highest value z-index +10 of the page to the new modal open, so that there is no problem.

I happen to be using another plugin that shows notifications at the top of the screen, and notifications are lagging behind the modal.

To get the highest z-index of the page I use the following code:

var zIndex = Math.max.apply(null,Array.prototype.map.call(document.querySelectorAll('*'), function (el) {
    return +el.style.zIndex;
})) + 10;

Is there any way to continue picking all the selectors (*) minus the class .notifications with .querySelectorAll() ?

    
asked by anonymous 19.04.2017 / 16:31

1 answer

2

Use not: CSS pseudo-class:

document.querySelectorAll('*:not(.notifications)');
    
19.04.2017 / 16:41