[Skip navigation links]
Login

Browser Compatibility Check BugIe11ScriptAttachEvent

Description

The element.attachEvent method was removed in Internet Explorer 11.

Help

Use the W3 standard addEventListener() instead, using feature detection to support old versions of IE:

 if (obj.addEventListener) { // use W3 DOM method if available (Chrome, Firefox, IE9+, Opera 7+) obj.addEventListener('click', myClick, false); } else if (obj.attachEvent) { // fallback for IE8 and earlier obj.attachEvent('onclick', myClick); } else { // fallback to DOM level 0 (only allows single event handler per event for each element) obj.onclick = myClick; } 

Applicable Standards

Change history

This page describes a web site issue detected by SortSite Desktop and OnDemand Suite.

Rule ID: BugIe11ScriptAttachEvent