On Click Copy the text in javascript

On Click Copy the text in javascript
$(".copy-mediaUrl").on('click' , function(){

     var b = $(this);

     var media_id = 'mediaurl-'+ b.data('id');

     var $temp = $("<input>");

     $("body").append($temp);

      $temp.val( $('#'+ media_id).text() ).select();

      document.execCommand("copy");

      $temp.remove();

      alert('Image Link Copied!');

});
Please follow and like us:
0