Created
March 9, 2019 23:19
-
-
Save fallengiants/52c89f2deb5a8657aa30027511e7c1f4 to your computer and use it in GitHub Desktop.
sample simple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var find = (a) => document.querySelectorAll(a) | |
| var titleNode = find('.content h1')[0] | |
| const onLoad = function(){ | |
| initButton() | |
| find('.content p:last-child')[0].classList.add('red') | |
| } | |
| function initButton(e){ | |
| var clicked_times = 0 | |
| var button = find('#clicky')[0] | |
| button.onclick = (e) => { | |
| titleNode.textContent = Math.random() * 9000 | |
| e.srcElement.value = `Clicked: ${++clicked_times}` | |
| } | |
| } | |
| document.addEventListener("DOMContentLoaded", onLoad); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment