Created
August 27, 2015 16:48
-
-
Save cmatskas/cbcd8b7a9b43879969df to your computer and use it in GitHub Desktop.
copy-to-clipboard.js
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
<script> | |
$(document).ready(function(){ | |
ZeroClipboard.config( { swfPath: "./ZeroClipboard.swf" } ); | |
var client = new ZeroClipboard($("#btnCopy")); | |
client.on("copy", function (event) { | |
var copiedValue = $('#txtTestInput').val(); | |
var clipboard = event.clipboardData; | |
clipboard.setData("text/plain", copiedValue); | |
alert('The copied value is: ' + copiedValue); | |
}); | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment