问题描述
我正在尝试使用Greasemonkey和jQuery 1.4.2.当我安装Greasemonkey脚本时,肯定会下载jQuery并显示在scripts目录中.但是,以下代码不会将任何内容附加到具有类PAPAGETITLE
的元素上.我在做什么错了?
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.");
推荐答案
更新:
从Greasemonkey版本0.9.1开始,jQuery 1.5.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不能在没有某些黑客的情况下与jQuery 1.4一起使用.
Greasemonkey does not work with jQuery 1.4 without some hacking.
使用jQuery 1.3.2
Use jQuery 1.3.2.
请参阅: http://forum.jquery.com/topic/importing-jquery-1-4-1-into-greasemonkey-scripts-generates-an-error (及其他).
这篇关于Greasemonkey和jQuery 1.4.2无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!