Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@redgoose-dev
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redgoose-dev/b591da6deb42ffd31213 to your computer and use it in GitHub Desktop.
Save redgoose-dev/b591da6deb42ffd31213 to your computer and use it in GitHub Desktop.
Copy the text to the clipboard
/**
* Copy the text to the clipboard
*
* @Param {String} : copy text
* @Param {String} : prompt message
* @Return void
*/
var copyClipboard = function(str, msg)
{
if (window.clipboardData)
{
window.clipboardData.setData('Text',str);
self.alert.open('copied clipboard', 'blue');
}
else
{
var result = prompt((msg) ? msg : "Press Ctrl+C to copy to your clipboard", str);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment