在Chrome的JavaScript控制台中未定义jQuery [英] jQuery is not defined in Chrome's javascript console

查看:213
本文介绍了在Chrome的JavaScript控制台中未定义jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个简单的jQuery函数以单击Medium的跟随"按钮.我写了这个,但是它返回未捕获的ReferenceError:未定义jQuery"

I'm trying to write a simple jQuery function to click on the "following" buttons of Medium. I wrote this but it returns "Uncaught ReferenceError: jQuery is not defined"

__cnt__ = 0;
jQuery('.button-activeState').each(function(i, ele) {
    ele = jQuery(ele);
    if (ele.css('display') != 'inline') {
        //alert('already following:', i);
        return;
    }
    setTimeout(function() {
        ele.click();
    }, __cnt__++ * 500);
});

我在做什么错了?

推荐答案

要包含jQuery 2.1.4,可以在控制台中运行以下命令:

To include jQuery 2.1.4, you could run the following in the console:

var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
jQuery.noConflict();

这篇关于在Chrome的JavaScript控制台中未定义jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆