I have this html:
<div>
<div><!-- all div without ID -->
<span>some text</span>
<div>
<span id="listener1">click here</span>
<span>sometext</span></div>
<div>
<span class="FIND_ME">Result Here</span></div>
</div>
<div>
<span>some text</span>
<div id="div1">
<div id="div2">
<span id="listener2">click here</span>
<span>sometext</span></div>
</div>
<div>
<span class="FIND_ME">Result Here</span></div>
</div>
</div>
Should be the following logic: wheen I click on "click here" the element with class "FIND_ME" should hide, which is the nearest common ancestor with the button pressed. Is it possible to do this?
$("#listener1").click(function(){
$(this).<SUPER_SEARCHING>.hide(); // for example hide, or add some CSS class
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…