How to copy text to clipboard in javascript
If the user want to copy some content ,he have to select some content then right click ,then click copy.if u want in ur appplication that there will be a control onclick of which the content of controls for example textbox will copy to click board,then call a javascript function onclick that button
< input type="button" value="copy" onclick="CopyToClipboard();"> function CopyToClipboard() { var textboxVal = document.getElementById("txtCopy").value; //txtText id of a textbox if( window.clipboardData && clipboardData.setData ) { clipboardData.setData("Text", textboxVal); } else { alert("works only in IE4+"); } }
Comments
Post a Comment