admin管理员组文章数量:1429561
Not sure if this is possible. I want to select all elements with a class name and only affect the one element being hovered at that time and not the whole class. i can't use ids since they are a lot.
$('.hideme').hover(function(){
$('.hideme').hide();
});
and then.
<div class='hideme'></div>
when the above hides, the following shouldn't hide.
<div class='hideme'></div>
<div class='hideme'></div>
<div class='hideme'></div>
Not sure if this is possible. I want to select all elements with a class name and only affect the one element being hovered at that time and not the whole class. i can't use ids since they are a lot.
$('.hideme').hover(function(){
$('.hideme').hide();
});
and then.
<div class='hideme'></div>
when the above hides, the following shouldn't hide.
<div class='hideme'></div>
<div class='hideme'></div>
<div class='hideme'></div>
Share
Improve this question
asked Nov 1, 2013 at 8:29
RelmRelm
8,29520 gold badges69 silver badges114 bronze badges
1 Answer
Reset to default 9If you try to hide
by using clss name
, then DOM will hide all the element with same name.
So you have to use this
keyword for selecting current hovered
element.
Try following:
$('.hideme').hover(function(){
$(this).hide();
});
本文标签: javascriptJquery only affect one element in a class being hoveredStack Overflow
版权声明:本文标题:javascript - Jquery only affect one element in a class being hovered - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745534631a2662216.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论