how to select all class except the clicked element in JQuery?

Use the not selector.

Example:

$('.collapsiblock').click(function(){
     $('.collapsiblock').not(this).each(function(){
         $(this).slideUp();
     });
     $(this).slideDown();
})

Leave a Comment