Greasemonkey and jQuery 1.4.2 not working

邮差的信 提交于 2020-01-02 07:24:06

问题


I am attempting to use Greasemonkey and jQuery 1.4.2. When I install the Greasemonkey script jQuery is definitely downloaded and appears in the scripts directory. However the below code doesn't append anything to elements with the class PAPAGETITLE. What am I doing wrong?

// ==UserScript==
// @name           PS Timesheet
// @namespace      http://www.steelebit.com/gmscripts
// @description    Used to fix a terrible implementation
// @include        https://intranet.site.com/*
// @require        http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
// ==/UserScript==

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

回答1:


Update:

As of Greasemonkey version 0.9.1, jQuery 1.5.1 seems to work fine in all of my scripts and tests so far.


Greasemonkey does not work with jQuery 1.4 without some hacking.

Use jQuery 1.3.2.

See: http://forum.jquery.com/topic/importing-jquery-1-4-1-into-greasemonkey-scripts-generates-an-error (and others).




回答2:


I've blogged about another possible solution here, which works with jQuery 1.4.*



来源:https://stackoverflow.com/questions/3207199/greasemonkey-and-jquery-1-4-2-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!