Uncaught TypeError: Cannot read property 'setData' of undefined
<p>i wrote Javascript that copies the data from textbox to the clipboard: </p>

<p><strong>TextBox:</strong></p>

<pre><code>&lt;asp:TextBox ID="contNoTxtBox" runat="server" Width="182px" style="height: 22px"&gt;&lt;/asp:TextBox&gt;
</code></pre>

<p><strong>Javascript:</strong> </p>

<pre><code>function CopyToClipBoard()
{
    var text = document.getElementById('contNoTxtBox').innerHTML;                       
    window.clipboardData.setData('Text', text);                       
}
</code></pre>

<p>and i call it in HTML button the following way: </p>

<pre><code>&lt;input id="CopyButton" type="button" value="Copy" onclick="CopyToClipBoard()" /&gt;&lt;br /&gt;
</code></pre>

<p>However i get the following error: </p>

<blockquote>
  <p>Uncaught TypeError: Cannot read property 'setData' of undefined</p>
</blockquote>

<p>Why am i getting this type pf error? </p>