Demo: https://pasquale-cs.github.io/copy-clipboard-js-jquery/
Plugin copy clipboard for Javascript and jQuery
Include "js/pcsCpClipboard.js" in your project and use the function "pcsCpClipboard('your-id')" for Javascript or "$.pcsCpClipboard()" for jQuery.
<body>
...
<script src="js/pcsCpClipboard.js"></script>
...
</body><body>
...
<div id="pcs-cp-container">
<h1>Plugin copy clipboard for Javascript and jQuery</h1>
<table>
<tr>
<th>FIELD 1</th>
<th>FIELD 2</th>
<th>FIELD 3</th>
</tr>
<tr>
<td>First</td>
<td><input type="text" value="123456"></td>
<td>Third</td>
</tr>
</table>
</div>
...
<button onclick="pcsCpClipboard('pcs-cp-container')">Copy Javascript</button>
<button id="pcs-cc-button">Copy jQuery</button>
...
<script>
// Only for jQuery
$(document).ready(function() {
$('#pcs-cp-container').pcsCpClipboard({ // Set elemente ID to copy (ONLY ID)
button: '#pcs-cc-button' // Set button for copy
});
});
</script>
...
</body>Give me a coffee: https://www.paypal.me/pasqualecs Thank you =)
Plugin per la copia negli appunti di un elemento della pagina per Javascript e jQuery.
Includere il file "js/pcsCpClipboard.js" net tuo progetto e usare la funzione "pcsCpClipboard('your-id')" per Javascript "$.pcsCpClipboard()" per jQuery.
<body>
...
<script src="js/pcsCpClipboard.js"></script>
...
</body><body>
...
<div id="pcs-cp-container">
<h1>Plugin copy clipboard for Javascript and jQuery</h1>
<table>
<tr>
<th>FIELD 1</th>
<th>FIELD 2</th>
<th>FIELD 3</th>
</tr>
<tr>
<td>First</td>
<td><input type="text" value="123456"></td>
<td>Third</td>
</tr>
</table>
</div>
...
<button onclick="pcsCpClipboard('pcs-cp-container')">Copy Javascript</button>
<button id="pcs-cc-button">Copy jQuery</button>
...
<script>
// Only for jQuery
$(document).ready(function() {
$('#pcs-cp-container').pcsCpClipboard({ // Set elemente ID to copy (ONLY ID)
button: '#pcs-cc-button' // Set button for copy
});
});
</script>
...
</body>Mi offri un caffè: https://www.paypal.me/pasqualecs Grazie =)