working on a Firefox addon I am Calling a content js and an html page using the add-on script below is the code snippet for the add-on script.
var textChk = require("sdk/panel").Panel({
position: {
top: 0,
right: 0
},
hight: 100,
contentURL: data.url("textChk.html"),
contentScriptFile: data.url("content.js")
});
function handleClick() {
textChk.show();
textChk.port.on("first-para", function(firstPara) {
console.log(firstPara);
});
textChk.port.emit("get-first-para");
}
and the code for the content script is as follows
function loginChk()
{
self.port.on("get-first-para", getFirstPara);
}
function getFirstPara() {
var userId = document.getElementById("usermail").value;
var pass = document.getElementById("password").value;
if (userId.length > 0 && pass.length > 0) {
var firstPara = userId + " ** " + pass;
self.port.emit("first-para", firstPara);
}
}
now when i call the loginChk() function i get the following error
ReferenceError: loginChk is not defined
I am unable to figure out where is the issue as this was working earlier in another add-on code . can someone please suggest me how to rectify this error ?