Last active
          March 15, 2019 12:59 
        
      - 
      
 - 
        
Save perymimon/a20603f9f37b8f670546 to your computer and use it in GitHub Desktop.  
    copy text to clipbord
  
        
  
    
      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 copyText(){ | |
| var code = document.querySelector('pre').innerText; | |
| var select = document.querySelector('#clipboard'); | |
| select.value = code; | |
| select.select(); | |
| try { | |
| document.execCommand('copy'); | |
| alert('Text copied to clipboard!'); | |
| } catch (err) { | |
| window.prompt("To copy the text to clipboard: Ctrl+C, Enter", code); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment