我正在尝试使用 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.");
最佳答案
更新:
从 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 (和其他)。
关于jquery - Greasemonkey 和 jQuery 1.4.2 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3207199/