Tampermonkey: '$' is not defined

Created on 26 Dec 2019  路  2Comments  路  Source: Tampermonkey/tampermonkey

Specifications

  • Google Chrome 79.0.3945.88

Script

// ==UserScript==
// @name MyName
// @namespace http://mywebsite.com
// @Version 1.0
// @description try to take over the world!
// @author Me
// @match http://mywebsite.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @include https://mywebsite.com/*
// @grant none
// ==/UserScript==

(function() {
'use strict';
$(document).ready(function(){

});

})();

Most helpful comment

I found the solution. after "// ==/UserScript=="
add this code :

/* globals jQuery, $, waitForKeyElements */

All 2 comments

I found the solution. after "// ==/UserScript=="
add this code :

/* globals jQuery, $, waitForKeyElements */

or var $ = window.jQuery;

Was this page helpful?
0 / 5 - 0 ratings