Created
April 25, 2022 09:23
-
-
Save NickyAlan/f209788bd14f826512004323ea30bd14 to your computer and use it in GitHub Desktop.
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
<div class="fromspeech"> | |
<div class="from1"> | |
<div id="div11">{{speech}}</div> | |
<button id="button1" onclick="CopyToClipboard('div11')">Click to copy</button> | |
</div> | |
<div class="from1"> | |
<div id="div12">{{result}}</div> | |
<button id="button2" onclick="CopyToClipboard('div12')">Click to copy</button> | |
</div> | |
</div> | |
<script> | |
function CopyToClipboard(containerid) { | |
if (document.selection) { | |
var range = document.body.createTextRange(); | |
range.moveToElementText(document.getElementById(containerid)); | |
range.select().createTextRange(); | |
document.execCommand("copy"); | |
} else if (window.getSelection) { | |
var range = document.createRange(); | |
range.selectNode(document.getElementById(containerid)); | |
window.getSelection().addRange(range); | |
document.execCommand("copy"); | |
} | |
} | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment