问题
I was creating a firefox extension. and I am including the jquery in the xul file as
<script type="application/x-javascript" src="libs/project/libs/jquery.js" />
followed by some other files which uses jquery
<script type="application/x-javascript" src="sample.js" />
<script type="application/x-javascript" src="sample2.js" />
.
.
.
but here I am getting some errors like
ReferenceError: jQuery is not defined
TypeError: a is undefined
ReferenceError: $ is not defined
what should I do ?
回答1:
Possible reason for this is this bug: http://bugs.jquery.com/ticket/12357
JQUERY 1.8.0 NOT PARSEABLE BY XUL RUNNER APPLICATIONS
You can test this by setting up a simple xul runner window and including jQuery, then alert the typeof jQuery or $ which will result in a response of undefined.
If you paste the jQuery code into a script tag in the XUL main window, you will be able to see all the various parsing issues that have been released in this build.
来源:https://stackoverflow.com/questions/13960797/jquery-in-firefox-extension