Friday, October 28, 2022

Copy to Clipboard using Javascript

 Copying the text to clipboard makes it easier to use the web page, so users will definitely like this functionality. You can achieve it using JavaScript.

Note: For this function to work in production environment, make sure your website has SSL Certificate


  <asp:Button ID="btnCopyResult" Visible ="false"   OnClientClick="CopyToClipBoard();"   class="btn btn-primary btn-sm"   runat="server" Text="Copy Result" />  

 <script type="text/javascript">

  function CopyToClipBoard()


var sData = "Copy ME!";




     return true;


 catch (err) 


    alert('Could not write to clipboard', err);

    return false;



No comments:

Post a Comment

LIveCharts2: Charts for Windows and web

Charts for Windows and web including .Net MAUI  LiveCharts - LiveCharts2 (