最も近いh2が、これは私がjQueryの:見つける私は、次のホバーイメージに最も近いH2タグを検索するタグ
$(document).ready(function() {
$('.img').hover(function(){
$(this).closest('h2').hide();
})
})
助けてくださいjqueryの中でやろうとしていますものです
<div class="col-md-3 col-sm-3 col-xs-12" style="padding-left:0;">
<div class="ih-item square effect7"><a href="#">
<div class="img">
<img src="images/facilities/facility1.png" class="img-responsive fullwidthimg">
</div>
<div class="info">
<h3>Content </h3>
<p>Some content </p>
</div></a>
</div>
<h2>Arenas</h2>
</div>
私のhtmlコードであります私はどうすればそれをすることができます。
変更してコードを)(非表示は;'、あなたはCSSセレクタのためのシングル/ダブルクォートの中にあなたのタグを含める必要が –
[特定のクラスを持つ最も近い祖先要素を見つける](https://stackoverflow.com/questions/22119673/find-the-closest-ancestor-element-that-has-a-specific-class)の可能な複製) – Rob
https://stackoverflow.com/questions/16194578/find-closest-element-in-complete-document – Rob