I am trying to run a script while loading a page using pageMod: but I could not see its effect
var data = require("sdk/self").data; var attachTo = require("sdk/content/mod").attachTo; var pageMod = require("sdk/page-mod"); pageMod.PageMod({ include: "*", contentScriptWhen: "start", allow:true, attachTo: ["existing", "top"], contentScriptFile: [data.url("jquery-2.1.1.min.js"), data.url("somejs.js")], })
Inside my somejs.js file, I have a form submit function:
document.forms['frmMain'].submit=function submit(){alert("Submitting")... ...do some stuff };
There is a button on my webpage that represents the form:
frmMain.method="post" frmMain.action = "someurl"; frmMain.submit();
But when I click the button, it does not call the override method described above. When I redefine a function using firebug console, it works! SO what does firebug do to run the command so that I can do the same in my add-on code to achieve the same.
source share