I have a basic test html page to test using ClipboardJS. It works when the target is html
<input type="text" id="bar" value="Click to copy me" />
<button class="btn" id="btnCopyToClipboard"
data-clipboard-action="copy"
data-clipboard-target="#bar"
onclick="return false">Copy Me</button>
However, I need to use an asp.net textbox as in:
<asp:TextBox ID="txtResponse" class="form-control ans_box_inner" TextMode="MultiLine" runat="server" Rows="20"></asp:TextBox>
and my “button” is defined using ClientID method:
<button id="btnCopyToClipboard" class="btn"
data-clipboard-action="copy" data-clipboard-target="#<%= txtResponse.ClientID %>'"
onclick="return false;">
<img src="Images/CopyToClipboardSmall.png" alt="Copy to clipboard" /></button>
And this is not working.