Copy Text to Clipboard JQuery

Kailash Singh

Copy Text to Clipboard JQuery

Published Oct 24,2021 by Kailash Singh

0 Comment     3108 Views    

In this tutorial, we are going to teach, how to create simple JQuery code to copy the text to the clipboard.

Here I make a simple button to copy the code.


Create text and Button

<h3 id="copy">I am copy this text</h3>
<button onclick="copyToClipboard('#copy')" class="btn btn-primary" title="Click to Copy">Copy</button>

In this button, we are creating a onclick function to copy the code.


JQuery code

You can create a function to copy the code.

<script type="text/javascript">
  function copyToClipboard(element) 
    var $temp = $('<input>');


Comments ( 0 )