Use new clipboard API
This commit is contained in:
parent
150fd50b13
commit
c88a0d0b11
|
@ -3,16 +3,8 @@
|
|||
|
||||
// Write your JavaScript code.
|
||||
|
||||
function copyToClipboard(field) {
|
||||
let textarea = document.createElement('textarea');
|
||||
textarea.id = 't';
|
||||
textarea.style.height = "0";
|
||||
document.body.appendChild(textarea);
|
||||
textarea.value = field;
|
||||
let selector = document.querySelector('#t');
|
||||
selector.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(textarea);
|
||||
function copyToClipboard(str) {
|
||||
navigator.clipboard.writeText(str);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
|
Loading…
Reference in a new issue