javascript - 使用 $(this) jquery 更改另一个元素

标签 javascript jquery this

所以,我知道如何更改您将鼠标悬停在其上的同一元素的属性...

$(".click2play").mouseover(function()
            {
              $(this).css({'visibility' : 'hidden'});
             });

问题我可以做同样的事情,但只影响悬停在同一个“click2play”div 中的另一个元素吗? 也许喜欢?

  $(".click2play").mouseover(function()
            {
              $(this).(#someotherdiv).css({'visibility' : 'hidden'});
             });

谢谢大家!

最佳答案

此代码的目标是当前 .click2play 元素内的 div。我相信这就是您所要求的:)

$(".click2play").mouseover(function() {
    $('div.class_name', this).css({'visibility' : 'hidden'});
});

关于javascript - 使用 $(this) jquery 更改另一个元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10465667/

相关文章:

javascript - 有没有办法在 CKEditor 中插入图像后运行 JavaScript 片段?

javascript - 如何从 JSON 映射嵌套数组?

javascript - 基于提取值的imacros javascript循环

javascript - 从 wordpress 站点中删除脚本

java - 有人可以向我解释一下关键字 "this"吗?

javascript - kendo ui Typescript this 关键字

javascript - 来自 html title 属性的 jquery 工具提示

javascript - Node.js - 类型错误 : Cannot read property 'document' of undefined

jquery - head中写jquery函数没有被调用

jquery - $(this) 在 jQuery 顶层的含义