jquery - 指定其中的一个类

标签 jquery

我有以下标记:

<div class='mb_post'>
blah blah blah
  <div class='mb_footer'>footer info</div>
</div>

mb_footer 将在加载时显示:无,然后我希望将鼠标悬停使其显示。我有:

$('.mb_post').on('mouseover',function(){
  $(this'.mb_footer').show();
});

但它不起作用。我如何指定仅存在于其中的 mb_footer?

提前致谢

最佳答案

差点就拥有了...

$('.mb_footer', this).show();

$ 函数的第二个参数可以是选择器的上下文。

或者,您可以执行$(this).find('.mb_footer')

关于jquery - 指定其中的一个类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13946513/

相关文章:

javascript - jquery添加元素,需要调用javascript函数

javascript - 脚本错误 : Unable to modify the parent container element before the child element is closed

javascript - JQuery 按钮数据返回为空?

鼠标悬停时 jQuery CSS 发生变化

javascript - 显示 'Closest' div

jquery - jquery下面的代码有什么错误

javascript - jQuery .index() 返回错误的数字

javascript - 创建 jquery 效果以在同一屏幕上显示新页面

jquery - 周 View 和日 View 中的全日历当前时间线

javascript - 动态创建的 jQuery 动画 div