Skip to content
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions docs/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,17 @@
function copyText() {
const copiedText = document.getElementById('copiedText').textContent
const textArea = document.createElement('textArea');
const copyBtn = document.getElementById("copyButton");

textArea.textContent = copiedText;
document.body.append(textArea);
textArea.select();
textArea.setSelectionRange(0, 99999)
document.execCommand('copy');
document.getElementById('copyButton')
.insertAdjacentHTML('afterend',
`<span style="margin-left:10px; font-size:14px;">Copied!</span>`
copyBtn.insertAdjacentHTML('afterend',
`<span style="margin-left:10px; font-size:14px;">Copied!</span>`
)
// alert("Code copied to clipboard: " + textArea.value);
}
copyBtn.classList.remove("waves-effect");
copyBtn.classList.remove("waves-light");
copyBtn.classList.add("disabled");
}