How to show that it was copied?

Hello!

Use a script to copy text: you pressed the button - the text copied. Screwed notice that when you copy surfaced block with the message that the text was successfully copied:

<button class="btn-clipboard" data-clipboard-text="<?php echo $login; ?>"><i class="fa fa-user" aria-hidden="true"></i><p>text 1</p></button>

<button class="btn-clipboard" data-clipboard-text="<?php echo $pass; ?>"><i class="fa fa-lock" aria-hidden="true"></i><p>text 2</p></button> 

var clipboard = new Clipboard('.btn-clipboard');

clipboard.on('success', function(e) {
$.jGrowl("Copied");
e.clearSelection();
});


He writes simply that the text has been copied, and how to make 1 when you copy text in the notification it was written that copied 1 text, and when copying of the second, it was written that copied second?
August 19th 19 at 23:06
2 answers
August 19th 19 at 23:08
Solution
clipboard.on('success', function(e) {
 $.jGrowl("Copied:" + e.text);
e.clearSelection();
});
August 19th 19 at 23:10
all these issues are resolved the same way:
print to the console the event and see what You need
clipboard.on('success', function(e) {
console.log(e);
$.jGrowl("Copied");
e.clearSelection();
});

Find more questions by tags HTMLJavaScript