aurweb/web/html/js/copy.js
Kevin Morris 5045f0f3e4
fix: copy.js javascript initialization
Not sure where this works, but it doesn't seem to work on my
browser. Achieved the same by forEaching through the array
returned by querySelectorAll instead.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-03-07 23:53:57 -08:00

9 lines
315 B
JavaScript

document.addEventListener('DOMContentLoaded', function() {
let elements = document.querySelectorAll('.copy');
elements.forEach(function(el) {
el.addEventListener('click', function(e) {
e.preventDefault();
navigator.clipboard.writeText(e.target.text);
});
});
});