javascript - jQuery parents then locate a div to hide -


ok, i've got .parents() function goes outside located class/id. in case, (.wrapper).

<div class="wrapper"> <div class="hide">hide class</div> <div class="boxclass></div> </div> 

i've got list of these div's on single page, so, if click "hide class" text, fadeout, since in list, has same class name. now, question. use .parents() locate (.wrapper) (i know can done (.parent)). how can use .parents go , select (fadeout) class inside it? ex, boxclass?

in case, they're siblings, use siblings()(docs) method in handler.

$(this).siblings('.boxclass').fadeout(); 

or if they're not siblings, use closest()(docs) method find()(docs) method.

$(this).closest('.wrapper').find('.boxclass').fadeout(); 

inside handler this represents element invoked handler. such, direct reference specific .hide element clicked.


Comments

Popular posts from this blog

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

jQuery clickable div with working mailto link inside -