How do I copy the contents of a textarea to the clipboard?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/400212/how-to-copy-to-the-clipboard-in-javascript">How to copy to the clipboard in JavaScript?</a>  </p>
</blockquote>



<p>I have an <code>html markup</code> thats echoed and is wrapped in a <code>textarea</code> and its also a read only like so:</p>

<pre><code>&lt;textarea rows="4" cols="70" readonly="readonly"&gt;text with markup goes here.&lt;/textarea&gt;
</code></pre>

<p>how do I do it that when a user clicked on the read-only text area contents, it will be automatically selected and copied to the clipboard and with a notification that its already copied?</p>
