Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 61381b5

Browse files
event handling basics
1 parent f07e55f commit 61381b5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎readme.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,3 +983,15 @@ var clone = oldNode.cloneNode(true);
983983
//then replace
984984
oldnode.parentNode.replaceChild(clone, oldNode);
985985
```
986+
987+
## event handling
988+
989+
* no ```onclick``` in HTML (seriously :)
990+
* usually via framework but worth knowing the basics
991+
* ```EventTarget.addEventListener(eventType, listener, useCapture)``` adds an event handler
992+
* event type - String representing event type to capture
993+
* listener - object implementing EventListener interface, or simply a function
994+
* useCapture - all events will events dispathed to this listener first before other listeners beneath this in the DOM tree
995+
* ```addEventListener``` is not available in IE8 and before
996+
* useCapture - optional (with default=false) in recent browser
997+
* just always pass useCapture in for brodest compatibility

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /