You can use :not selector
$('.products .product-category:not([data-slug="'+slug+'"]) .expander').slideUp()
Frage
$('.products .product-category[data-slug="'+slug+'"] .expander').slideDown();
I have the above selector but I am trying to add another selector elsewhere that select all BUT [data-slug="'+slug+'"]
and slide them up using .slideUp()
Thanks
Lösung
You can use :not selector
$('.products .product-category:not([data-slug="'+slug+'"]) .expander').slideUp()
Andere Tipps
Try .not()
$('.products .product-category').not('[data-slug="'+slug+'"] .expander').slideUp();
$('.products .product-category:not([data-slug="'+slug+'"] .expander').slideUp();
Attribute Not Equal Selector [name!="value"]
$('.products .product-category[data-slug!="'+slug+'"] .expander').slideDown();
Try to use .not():
$('.products').not('.product-category[data-slug="'+slug+'"] .expander').slideUp();
Try .not()
:
$('.products .product-category').not('[data-slug="'+slug+'"]').find('.expander').slideUp();