Doubt about "parent" in Jquery [closed]

1

I want when I click the class atendimento a class horarios stay with display:block

Follow my HTML:

<div class="margin-top-30 pai">
    <ul class="horarios">
        <li class="horariosFechar">x</li>            
    </ul>
    <div class="unidadesTotal">
        <div style="display:none" class="unidadesConteudo margin-top-25">
            <div class="atendimento unidadesAtendimento margin-top-15 f-left">hor&aacute;rio de atendimento</div>
        </div>
    </div>
</div>

And my JQUERY:

$( ".atendimento" ).click(function() {
    $(this).parent.parent.parent.find( ".horarios" ).css('display','block');
});

That is, I'm coming back with parent so I can click, whatever happens, it's not working.

    
asked by anonymous 14.11.2014 / 19:43

1 answer

4

You have forgotten the parentheses after parent . An alternative to avoiding this amount of parent is to use parents as follows:

$(this).parents('.pai').find('.horarios').show();
    
14.11.2014 / 19:45