Forum Moderators: open
function copyToClipboard(textareaID) {
// Get the text in the textarea
theText = document.getElementById(textareaID).innerText;
// Create a textRange for the clipboad
copyText = theText.createTextRange();
// Remove any formatting, this allows you to copy code etc.!
copyText.execCommand("RemoveFormat");
// Copy the text to the clipboard
copyText.execCommand("Copy");
}
More on execCommand can be found on MSDN [msdn.microsoft.com].
HTH