good-listener/demo/node.html
raw| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <title>Node</title> |
| 6 | </head> |
| 7 | <body> |
| 8 | <!-- 1. Write some markup --> |
| 9 | <button id="target">Click me</button> |
| 10 | |
| 11 | <!-- 2. Include library --> |
| 12 | <script src="../dist/good-listener.js"></script> |
| 13 | |
| 14 | <!-- 3. Add listener by passing a HTML element --> |
| 15 | <script> |
| 16 | var target = document.getElementById('target'); |
| 17 | |
| 18 | listen(target, 'click', function(e) { |
| 19 | console.info(e); |
| 20 | }); |
| 21 | </script> |
| 22 | </body> |
| 23 | </html> |