3
Answers

Clipboard copy javascript all browsers but my code not work

Prakash Kumar

Prakash Kumar

8y
302
1
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>

Answers (3)