Common targets are Element, Document, and Window, but the target may be any object that supports events (such as XMLHttpRequest).. addEventListener() works by adding a function or an object that implements EventListener … To remove a function object, we need to store a reference to it, like this: ) ; } ) ; // For compatibility, a non-function object with a `handleEvent` property is // treated just the same as a function itself. When the event occurs, an event object is passed to the function as the first parameter. Fixed add() being called instead of assigned as just add in the addEventListener. Specifies the function to run when the event occurs. See it in action in the CodeSandbox demo. will // appear. Is there a standard function to check for null, undefined, or blank variables in JavaScript? Why is it "crouching tiger hidden dragon" but not "crouching tiger hiding dragon"? // Whenever the element is clicked, a pop-up with "Element clicked!" Note: Do not use the "on" prefix. Note: This little vanilla framework uses the FileReader API, which is a recent technique (but only when there are files to upload, the method of the