Greasemonkey和jQuery 1.4.2无法正常工作

时间:2010-07-08 19:29:29

标签: jquery greasemonkey

我正在尝试使用Greasemonkey和jQuery 1.4.2。当我安装Greasemonkey脚本时,jQuery肯定会被下载并出现在脚本目录中。但是,以下代码不会向类PAPAGETITLE的元素追加任何内容。我做错了什么?

// ==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.");

2 个答案:

答案 0 :(得分:2)

更新

从Greasemonkey版本0.9.1开始,到目前为止,jQuery 1.5.1似乎在我的所有脚本和测试中都能正常工作。


如果没有一些黑客攻击,Greasemonkey不能与jQuery 1.4一起使用。

使用jQuery 1.3.2。

请参阅:http://forum.jquery.com/topic/importing-jquery-1-4-1-into-greasemonkey-scripts-generates-an-error(和其他人)。

答案 1 :(得分:1)

我发表了关于another possible solution here的博文,该版本适用于jQuery 1.4。*