<script>
function loadEvent() {
document.getElementById("copyCode").addEventListener("click", copyElementText); //replace copyCode with your button ID
console.log("loaded");
}
window.onload = loadEvent;
function copyElementText(id) {
var text = document.querySelector(".syntaxhighlighter").innerText; //replace .syntaxhighliter with your selector
var elem = document.createElement("textarea");
document.body.appendChild(elem);
elem.value = text;
elem.select();
document.execCommand("copy");
document.body.removeChild(elem);
console.log("Yeah");
// document.querySelector("#copyCode > span > span.elementor-button-text").innerText = "copied !";
setTimeout( function() {
// document.querySelector("#copyCode > span > span.elementor-button-text").innerText = "copy code";
}, 2000);
}
</script>
- +49 561 9963 9601
- hello@eboosting.net
- Resources
Fachbeitrag: Nutzerzentrierte Erhebungsmethoden