add buttons and eventListeners

This commit is contained in:
Stefan Feješ
2017-12-23 15:19:41 +01:00
parent 2446be2556
commit 5c33ce5a1e
4 changed files with 14 additions and 0 deletions

10
docs/bundle.js Normal file
View File

@ -0,0 +1,10 @@
var s = document.querySelectorAll("pre");
s.forEach(element => {
var button = document.createElement("button");
button.innerHTML = "Copy to clipboard";
element.parentElement.appendChild(button);
button.addEventListener ("click", function() {
console.log(element.textContent);
});
});