When I have the code and test it in my chrome it doesn't work in my local client.
What am I missing?
function copyToClipboard( text ){
var copyDiv = document.createElement('div');
copyDiv.contentEditable = true;
document.body.appendChild(copyDiv);
copyDiv.innerHTML = text;
copyDiv.unselectable = "off";
copyDiv.focus();
document.execCommand('SelectAll');
document.execCommand("Copy", false, null);
document.body.removeChild(copyDiv);
}
<input type="submit" onclick="copyToClipboard('testtestt')" >
Thanks!
http://www.pakzilla.com/2012/03/20/how-to-copy-to-clipboard-in-chrome-extension/