I have been working on an angularjs application
. We have implemented a functionality to display alerts for unsaved changes using
window.event.target. Everything was functioning correctly in all browsers except for <code>Firefox
. The error message we encountered was 'window.event is undefined'. Have you ever experienced this issue? Any suggestions on how to resolve it would be greatly appreciated. Please assist us.
<!DOCTYPE html>
<html>
<body>
<input value="click" type="button" onclick="call()" />
<script>
function call() {
var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // workaround for Safari bug
targ = targ.parentNode;
}
</script>
</body>
</html>