2

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);
});

What am I doing wrong?

Kevin B
  • 94,570
  • 16
  • 163
  • 180
nico_lrx
  • 715
  • 1
  • 19
  • 36

2 Answers2

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();
greed
  • 442
  • 1
  • 3
  • 10
0

"Uncaught ReferenceError: jQuery is not defined"

Mean that there's no jquery included, so make sure that jquery is included, and place your script after include of librairy.

Zakaria Acharki
  • 66,747
  • 15
  • 75
  • 101