Copy to Clipboard Button

<script type="text/javascript">

function CopyToClipboard()

CopiedTxt = document.selection.createRange();


<form name="Form1">
Here is some text you can copy. You can copy text from anywhere on the page, simply select it and press the Copy to clipboard button. Then you can paste it anywhere you want, in Notepad, Visual Studio or in the textarea below. <br />
<br />
<textarea id="txtArea" cols="60" rows="5">You can also copy text from this textarea. Or you can paste the text here, using the Ctrl+V key combination.</textarea>
<br />
<input type="button" onClick="CopyToClipboard()" value="Copy to clipboard" />


You must be logged in to post a comment.

  1. This doesnt work in mozilla? Why, please help!

    • For sure, this is an old snippet and I have not as of yet figured out a new technique. Good luck, if you find one send me a link.

  2. This is great! thanks for the information. I will definitly revisit this blog again.