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 6473041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:25:06+00:00 2026-05-25T06:25:06+00:00

From the greasemonkey wiki page, there is an example using jQuery with greasemonkey. The

  • 0

From the greasemonkey wiki page, there is an example using jQuery with greasemonkey. The code is listed below and the location of the page is http://wiki.greasespot.net/Third-Party_Libraries#jQuery

// ==UserScript==
// @name          jQuery Example
// @require       http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==

// Append some text to the element with id someText using the jQuery library.
$("#someText").append(" more text.");

This example script modify the DOM directly. Do I need to surround the code with a jQuery function like this:

// ==UserScript==
// @name          jQuery Example
// @require       http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==

// Append some text to the element with id someText using the jQuery library.
jQuery(function(){
    $("#someText").append(" more text.");   
})

I ask this question is because my greasemonkey code is not executed every time the page is refreshed. Any ideas on this issue?
Thanks.

  • 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-05-25T06:25:07+00:00Added an answer on May 25, 2026 at 6:25 am

    No, there is no point in wrapping your script code in a jQuery() call, nor in using $(document).ready ().

    Greasemonkey automatically fires after both the DOMContentLoaded event (same as the jQuery wrapper or ready event), and after GM’s version of jQuery is loaded.

    Also note that that wiki page is outdated. GM works fine with jQuery 1.6.2 now.

    You didn’t show the relevant code, nor link to the target page, but the most-likely reasons the “Greasemonkey code is not executed every time the page is refreshed” are:

    1. There is an error in the GM script.

    2. The target content is loaded separately, via AJAX.
      You can use code in this pattern, to get around that:

      //--- This handles both page-load delays, and AJAX changes.
      setInterval (function() { checkForTweetbox (); }, 500);
      
      function checkForTweetbox () {
          var tweetbox = document.querySelector ('div.tweet-box textarea');
          if (tweetbox) {
              if (! tweetbox.weHaveProcessed) {
                  tweetbox.weHaveProcessed    = true;
                  alert ('New tweet-box found!');
              }
          }
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm working on a Greasemonkey UserScript for Clients From Hell http://clientsfromhell.net/ and I'm
I'm using a Greasemonkey script to pull data from the RSS feed http://www.instapaper.com/folder/48337/rss/11185/QBV0RZfH4KBO7GwgrR3D8b7sv90 and
I have captured list of data from the page using Greasemonkey. GM Script var
I want to use greasemonkey to scrape wiki data from Last.fm (this is not
Can I save page pictures from GreaseMonkey script directly to my hard drive? Is
I'm trying to get a jsonp callback working using jquery within a greasemonkey script.
I'm trying to retrieve a page with greasemonkey and then extract a link from
I am trying to script a web page using GreaseMonkey. (I am using Firebug
I am writing a Greasemonkey script using jquery, and I want to add information
Would anyone be able to tell me the Greasemonkey code to make this page

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.