Created
July 17, 2016 02:59
-
-
Save onigetoc/f85f97e352bac05fd401b8b037c00a05 to your computer and use it in GitHub Desktop.
Copy to clipboard Javascript - copyToClipboard
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
// copy to clip board | |
$("#copy").click(function() { | |
copyToClipboard('#allContent'); | |
}); | |
function copyToClipboard(element) { | |
var $temp = $("<textarea>"); | |
$("body").append($temp); | |
$temp.val($(element).html()).select(); | |
document.execCommand("copy"); | |
$temp.remove(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment