Skip to content Skip to sidebar Skip to footer

Toggle Class Visibility By Clicking On Another Class

I am working on a project and I need to be able to click .node-202 .field-name-field-pin-point and toggle the visibility of .node-202 .group-dealer. I need both identifiers in the

Solution 1:

Assuming that the HTML structure looks like this (and that you have multiple instances of this structure, so you can't just use the class names):

<div class="node-202">
    <div class="field-name-field-pin-point">...</div>
    <div class="group-dealer">...</div>
</div>

you need something like this:

$('.node-202 .field-name-field-pin-point').click(function() {
    $(this).siblings('.group-dealer').toggle();
});

TEST IN JSFIDDLE


Solution 2:

Try this..

 $('.node-202 .field-name-field-pin-point').bind('click', function(){

            $('.node-202 .group-dealer').toggle();

    })

FIDDLE DEMO


Post a Comment for "Toggle Class Visibility By Clicking On Another Class"