Last active
February 4, 2020 12:38
-
-
Save motsu0/12b92d0c2d3abbbf842aa7a234135c54 to your computer and use it in GitHub Desktop.
This file contains 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
<input type="text" id="copy-text" value="これをコピーさせる"> <button id="bt-copy">copy</button> |
This file contains 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
document.getElementById('bt-copy').addEventListener('click',()=>{ | |
const target = document.getElementById('copy-text'); | |
target.select(); | |
document.execCommand('copy'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment