简体   繁体   English

jQuery单击在Google云端硬盘中不起作用

[英]jQuery click doesn't work in Google Drive

jQuery click doesn't work in https://drive.google.com/drive/folders/XXXXXXX jQuery单击在https://drive.google.com/drive/folders/XXXXXXX不起作用

Here is the div that I'm trying to click. 这是我要点击的div。

<div class="j-Ta-pb j-ia-e a-Cs-A-e a-d-e" role="button" style="-moz-user-select: none;" aria-hidden="false" aria-expanded="false" aria-haspopup="true" data-tooltip="More actions" aria-label="More actions" tabindex="0"><div class="a-e-d"><svg focusable="false" viewBox="0 0 20 20" height="20px" width="20px" y="0px" x="0px"><path d="M10,6c1.104,0,2-0.896,2-2s-0.896-2-2-2S8,2.895,8,4S8.896,6,10,6z M10,8c-1.104,0-2,0.896-2,2s0.896,2,2,2s2-0.896,2-2  S11.104,8,10,8z M10,14c-1.104,0-2,0.896-2,2s0.896,2,2,2s2-0.896,2-2S11.104,14,10,14z" fill="#000000"/></svg></div></div>

In Firebug console I run command $('.j-Ta-pb.j-ia-ea-Cs-Ae.ad-e').click(); 在Firebug控制台中,我运行命令$('.j-Ta-pb.j-ia-ea-Cs-Ae.ad-e').click();

And I'm getting this : 我得到这个:

Object[div.j-Ta-pb.j-ia-e.a-Cs-A-e.a-d-e, div.j-Ta-pb.j-ia-e.a-Cs-A-e.a-d-e, div.j-Ta-pb.j-ia-e.a-Cs-A-e.a-d-e, div.j-Ta-pb.j-ia-e.a-Cs-A-e.a-d-e]

I also tried to change :eq from :eq(0) to ;eq(4) - nothing changes, It doesn't show "More actions" options. 我还尝试将:eq从:eq(0)更改为; eq(4)-没有任何变化,它没有显示“更多操作”选项。

+++UPDATE+++ +++ UPDATE +++

jQuery does work jQuery确实有效

var script = window.content.document.createElement('script');
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js';
script.type = 'text/javascript';
window.content.document.getElementsByTagName('head')[0].appendChild(script);

Google Drive doesn't seem to have jQuery on it. Google云端硬盘似乎没有jQuery。 There are many ways you can tell it's not jQuery, one of the easiest is $.fn is undefined. 有很多方法可以告诉您它不是jQuery,最简单的方法之一是$ .fn是未定义的。

It turns out that web developer consoles (at least in recent versions of Firefox and Chrome) alias $ to a query selector that is similar to jQuery's, though not identical. 事实证明,Web开发人员控制台(至少在最新版本的Firefox和Chrome中)将$别名命名为类似于jQuery的查询选择器,尽管不完全相同。 This is likely what you're seeing here. 这可能是您在这里看到的。 Check out the documentation for Firefox here . 在此处查看Firefox的文档。

If you need jQuery in the page this should get you started. 如果您在页面中需要jQuery,则应该开始使用。

Good luck! 祝好运!

.click() has been deprecated for a while try using .click()已被弃用一段时间,尝试使用

$('.j-Ta-pb.j-ia-e.a-Cs-A-e.a-d-e').on("click", function(e) {
    console.log(e);
    // Do something here
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM