Question

This is only happening in Chrome. IE and Firefox work just fine. In the console I get the error: Uncaught TypeError: object is not a function enter image description here

It is saying the error is here but I don't even know where this is:

(function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {onclose()
};}}}})
Was it helpful?

Solution

You have some sort of conflict with that function name.

Try:

window.onclose();

Or even better:

document.getElementById("aerror").addEventListener('click', function() {
    alert('Hello world');
}, false);

You should always use event listeners: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener#Why_use_addEventListener.3F

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top