Skip to content

Instantly share code, notes, and snippets.

@fallengiants
Created March 9, 2019 23:19
Show Gist options
  • Select an option

  • Save fallengiants/52c89f2deb5a8657aa30027511e7c1f4 to your computer and use it in GitHub Desktop.

Select an option

Save fallengiants/52c89f2deb5a8657aa30027511e7c1f4 to your computer and use it in GitHub Desktop.
sample simple
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