Pergunta

$('.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

Foi útil?

Solução

You can use :not selector

$('.products .product-category:not([data-slug="'+slug+'"]) .expander').slideUp()

Outras dicas

Try .not()

$('.products .product-category').not('[data-slug="'+slug+'"] .expander').slideUp();


:not()

$('.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();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top