add buttons and eventListeners
This commit is contained in:
10
docs/bundle.js
Normal file
10
docs/bundle.js
Normal 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user