copy text to clipboard

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);
alert("works only in IE4+");

Article by Abhay Kumar Raut
DNS MVM and .Net Guru Team Lead at CirrusCloud Systems Bhubaneswar,Odisha Thanks and Regards, Abhay Kumar Raut

Follow Abhay Kumar Raut or read 39 articles authored by Abhay Kumar Raut


Author: Phagu Mahato23 Feb 2014 Member Level: Gold   Points : 5

Copy to ClipBoard Test

Copy to clipboard test..

Click here copy to clipboard

PasteYou text here.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: