I have been mass following / unfollowing / favoriting / unfavoriting on twitter with these codes ;
$(\'button.follow-button\').click();
$(\'button.ProfileTwe
In my case there was a conflict between jquery and another library so I had to implement a jQuery.noConflict();
in a script before calling in my main script.
You could read more about jquery conflict here
I had encountered this problem, when I run javascript on the webpage from elsewhere (eg. Selenium) while simultaneously using Developer Tools. Try closing Developer Tools and run the script.
In my case the solution was to simply turn off the element-inspector within my browser! :)
In order to use the jQuery library, you need to make sure that the library has been loaded on the page. As @adeneo mentioned, jQuery does not return null values, which means the $
variable is holding reference to an object that isn't jQuery. To verify that jQuery is loaded on a page, enter typeof jQuery
into the chrome debugger. If jQuery is loaded on the page, the console will output "function". Otherwise, it will output "undefined". Steps for adding jQuery to your page can be found here.
Once you have verified that jQuery is properly loaded on the page, you will have to correct the CSS selector that you are using to access the desired element.
$(".a.follow")
means "select all elements that have both classes 'a' and 'follow'".
<div class="a follow"></div>
Instead, your selector should be $("a.follow")
, which means "select all 'a' type elements that have the 'follow' class".
<a class="follow"></a>