Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2017
    Posts
    16
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Can't get Jquery to work on tampermonkey

    I'm trying to make a button appear on a webpage but, the problem is Tampermonkey says "$ is not defined" when I try using Jquery.

    Code:
    // ==UserScript==
    // @name       Test
    // @namespace    http://tampermonkey.net/
    // @version    0.1
    // @description  Tests stuff
    // @author       You
    // @match      https://RandomWebsite.com
    // @require http://code.jquery.com/jquery-3.3.1.min.js
    // ==/UserScript==
    // ==UserScript==
    
        $('body').append('<input type="button" value="Open" id="CP">')
        $("#CP").css("position", "fixed").css("top", 0).css("left", 0);
    I'm probably just being really dumb but I can't figure it out.

  2. #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    19,541
    Thanks
    221
    Thanked 2,712 Times in 2,686 Posts
    It looks to me that you do not have Jquery enabled.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  3. #3
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Location
    Here
    Posts
    3,847
    Thanks
    58
    Thanked 690 Times in 685 Posts
    If your target page is already using jQuery you may not need to require it. Of it is you may want to use jquery.noconflict to avoid, well, conflicts


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •