Show/Hide Multiple Class Elements Indepently

$(function() {

    $('.button').click(function() {

        // jQuery.prev()

        $(this).prev('.hide-show').toggle();

        

        // jQuery.next()

        $(this).next('.hide-show').toggle();

        

        return false;

    });

});

Add additional controls if you’re using a different trigger to close the elements:

jQuery('.second_button_hide').click(function(){

	jQuery('.hide-show').hide();

});

Sourced here.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.