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

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -