I wrote a script in jquery that adds class to all the elements on the page with the help of the selector * (all). I would like to rule out one element of the div with all his children. I'm wondering how to do that. I tried to use a pseudo-class :not, including the mentioned div, but I don't know how to exclude his children as well. Can any of you help me solve this ?
Code with pseudo-class :not
$(document).ready(function(){
$('#yellow-background').click(function(){
$(':not(div[aria-label="Slajder"])').addClass("yellow-background");
});
Normal code:
$(document).ready(function(){
$('#yellow-background').click(function(){
$('*').addClass("yellow-background");
});