I have the following script that simply and easily allows me to copy the URL from an attribute added to an HTML tag:
$(document).ready(function(){
$('.clipboard').on("click", function(){
value = $(this).data('ref');
var $temp = $("<input>");
$("body").append($temp);
$temp.val(value).select();
document.execCommand("copy");
$temp.remove();
})
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<span class="clipboard" data-ref="example.com1">Copy URL</span>
<span class="clipboard" data-ref="example.com2">Copy URL</span>
But I would like to be able to add an effect when copying the url, a notification similar to bitly, for example:
If you can see bitly it emits an effect when copying the url.
I would like to add something similar, but instead of creating the notification from the same copied url, create a similar effect but with the following word: URL copied!
Could you explain to me how I could add this notification?
