Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js copy to clipboard

Also works on safari!
  
function copyToClipboard() {
    var copyText = document.getElementById("share-link");
    copyText.select();
    copyText.setSelectionRange(0, 99999);
    document.execCommand("copy");
}
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #js #copy #clipboard
ADD COMMENT
Topic
Name
1+8 =