Created
October 23, 2019 21:04
-
-
Save g-rodigy/fbcd9c60527c484daf70c5dbd7287b2a to your computer and use it in GitHub Desktop.
Copy text on buffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BufferCopy(str) { | |
var tmp = document.createElement('INPUT'); | |
tmp.value = str; | |
document.body.appendChild(tmp); | |
try { | |
tmp.select(); | |
document.execCommand('copy'); | |
//alert('Скопировано.') | |
}catch(e){ | |
alert('Ваш браузер не поддерживают эту функцию. Скопируйте текст вручную.'); | |
} | |
document.body.removeChild(tmp); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment