再会。我想在我的 FireFox 扩展中添加 jQuery 我在 .xul 中添加文件并使用以下代码:
main.xul:
<overlay id="sample"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<script type="application/x-javascript" src="chrome://mozillatest/content/jquery.js" />
<script type="application/x-javascript" src="chrome://mozillatest/content/main.js" />
</overlay>
main.js 文件:
document.addEventListener("DOMContentLoaded", function(){
$whatever = jQuery.noConflict();
if (window.$whatever) {
alert('1 check - OK 1!');
$whatever('form').on('submit', function(e) {
alert('submited');
});
});
我看到警报“1 检查 - 确定 1!” 但是当我导航到某些站点并按提交时,我看不到警报“已提交”。我在 Chrome 中编写扩展程序,它可以正常工作!我需要做什么?