Click here to Skip to main content
15,888,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
label here is values
<label id="lblFileName" style="font-size:16px;font-weight:bold"></label>
button here

<button class="btn" data-clipboard-action="copy" data-clipboard-target="#lblFileName">Copy</button>

javascript code here

<script src="~/clipboard.js-master/dist/clipboard.min.js"></script>

<script>
var clipboard = new Clipboard('.btn');

clipboard.on('success', function (e) {
console.log(e);
});

clipboard.on('error', function (e) {
console.log(e);
});
</script>

What I have tried:

i have tried this code

label here is values
<label id="lblFileName" style="font-size:16px;font-weight:bold"></label>
button here
Hide Copy Code
<button class="btn" data-clipboard-action="copy" data-clipboard-target="#lblFileName">Copy</button>

javascript code here

<script src="~/clipboard.js-master/dist/clipboard.min.js"></script>

<script>
var clipboard = new Clipboard('.btn');

clipboard.on('success', function (e) {
console.log(e);
});

clipboard.on('error', function (e) {
console.log(e);
});
</script>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900