I have an Email address in my page and I want when user clicks on it, then the Email address would be copied to the clip board and with small alert(like attached) it shows user in a small label near the box that it copied to clipboard,
I used https://clipboardjs.com/ to implement my goal. it copied to clipboard fine, but the problem is that it doesn't show user that it copied to clipboard after clicks on it,
my code if needed:
javascript
new Clipboard('.btn');
html
<button class="btn" data-clipboard-text="test@test.com">
test@test.com
</button>
Appreciate any suggestion
Actually, the tooltip is not a part of the clipboard.js
. If you look at the source code of the page, you can see that tooltip.js
is been added and configured in demo.js
.
All you need to do is add a tooltip library or function just like the demo page and use it on button click.
Hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.