Error: TypeError: window.attachEvent is not a function

javascript, jquery

Solution

When attaching events in order to make it cross browser perform the following:

if (target.addEventListener) {
    target.addEventListener(eventName, handlerName, false);
} else if (target.attachEvent) {
    target.attachEvent("on" + eventName, handlerName);
} else {
    target["on" + eventName] = handlerName;
}

Problem

I am using `custome.js`,`PIE.js` and `jquery1_7_2.js` file in my `jsp` This is my custome.js and nothing more. ``` jQuery(document).ready(function(){ jQuery(function() { if (window.PIE) { jQuery('#login-box, .sign-button, .new-user-btn, .grey-btn, .code-btn, #contact-email, #contact-email .continue, #contact-email .cancel').each(function() { PIE.attach(this); }); } }); }) ``` everything working fine in all browser. But in Firefox it is showing me this error ``` Error: TypeError: PIE.attach is not a function Source File: http://localhost:8080/MyApp/js/custom.js Line: 6 ``` Please guide me to solve this issue. Edited: It showing me error in this line of PIE.js window.attachEvent("onunload",a);f.K.sa=function(b,c,d){b.attachEvent(c,d);this.ba(function(){b.detachEvent(c,d)})}})();f.Qa=new f.ea;f.K.sa(window,"onresize",function(){f.Qa.wa()});(function(){function a(){f.mb.wa()}f.mb=new f.ea;f.K.sa(window,"onscroll",a);f.Qa.ba(a)})();(function(){function a(){c=f.kb.md()}function b(){if(c){for(var d=0,e=c.length;d and custome.js in this line PIE.attach(this);

Original source