Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7888163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:45:50+00:00 2026-06-03T05:45:50+00:00

I am having issues triggering a jQuery click through Greasemonkey/Tampermonkey… jQuery(‘button’).each(function() { jQuery(this).css(‘background’, ‘red’);

  • 0

I am having issues triggering a jQuery click through Greasemonkey/Tampermonkey…

jQuery('button').each(function() {
    jQuery(this).css('background', 'red');
    jQuery(this).click();
    location.assign("javascript:jQuery(this).click();void(0)");
}​

As you can see I’ve even tried the location.assign hack but nothing will work, no errors in the console either.

Funny thing is that yes, the background colour does change to red so I am assuming it’s something in the way .click() works that is different from other jQuery methods.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:45:51+00:00Added an answer on June 3, 2026 at 5:45 am

    jQuery’s .click() is just a shortcut for jQuery’s .trigger() and from the Docs:

    Any event handlers attached with .bind() or one of its shortcut methods are triggered when the corresponding event occurs. They can be fired manually, however, with the .trigger() method.

    This means that event-handlers, that are not set by jQuery, cannot always be triggered by .click() (or .trigger()).

    To get around this, send actual mouse events:

    jQuery ('button').each ( function () {
        jQuery (this).css ('background', 'red');
    
        var clickEvent  = document.createEvent ('MouseEvents');
        clickEvent.initEvent ('click', true, true);
        this.dispatchEvent (clickEvent);
    }
    


    Note that in some rare cases, the page will actually work off a combination of events, not the click, and that theoretically, pages can discriminate against any artificially produced event (though I’ve yet to see that in the wild).
    If that is the case here, link to the target page so that we can make workaround(s).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having issues referencing $(this) from within a the nested ajax 'success' function... I know
Having issues getting jQuery to work in this scenario: Visual Studio 2010 .Net 4.0
Having issues trying to get this jquery code to work. The idea is that
I'm having issues getting a variable declared in an .click function to be updated
Still having issues with this problem. Please help if you can. So I am
Im having issues getting this to work, maybe its not even possible? I have
I am having issues with loading external javascript using JQuery. Every time when I
I am having issues getting my JQuery Selector to access a particular HTML element.
I'm having trouble understanding why I have to place the button triggering the getJSON
Having issues displaying some websites within iframes. Live example of code This one works.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.