Skip to content

Instantly share code, notes, and snippets.

@seunggabi
Last active March 17, 2020 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seunggabi/7ae53c100d647cb19c48047cff9b7019 to your computer and use it in GitHub Desktop.
Save seunggabi/7ae53c100d647cb19c48047cff9b7019 to your computer and use it in GitHub Desktop.
copy.js
<style>
.blind {
overflow: hidden;
position: absolute;
clip: rect(0 0 0 0);
width: 1px;
height: 1px;
margin: -1px;
}
</style>
<textarea id="copy" class="blind" readonly>
your copy text here!
</textarea>
<script>
copyClipboard(document.getElementById('copy'));
function copyClipboard(el) {
el.select();
window.document.execCommand('copy');
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment