Answer the question
In order to leave comments, you need to log in
Why is the console displayed not one at a time, but several at once?
Good day everyone! I am using ClipboardJS to copy to clipboard. When the function is executed, the copied text is displayed in the console, but when you click again, the numbers in the console are added not + 1, but taking into account previous executions of the function. +15 maybe, then +30 and so on. Why is this happening? I have seen this before with other plugins. Below is a photo to make it clear what numbers I'm talking about.
let Ranqau = document.getElementsByClassName('Auweque')[0].getElementsByTagName('p')[0];
let Wonequ = document.getElementsByClassName('Wuonewke')[0];
new ClipboardJS(Wonequ, {
text: function(){
return Ranqau.innerHTML;
}
}).on('success', function(e){
console.log('New Copy: ' + e.text);
e.clearSelection();
});
Answer the question
In order to leave comments, you need to log in
Got it, the code is:
let Ranqau = document.getElementsByClassName('Auweque')[0].getElementsByTagName('p')[0];
let Wonequ = document.getElementsByClassName('Wuonewke')[0];
let Newenu = new ClipboardJS(Wonequ, {
text: function(){
return Ranqau.innerHTML;
}
}).on('success', function(e){
console.log('New Copy: ' + e.text);
e.clearSelection();
Newenu.destroy();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question