Skip to content

Commit

Permalink
Fix copy link function (cotes2020#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 authored and sanjidnet committed Dec 26, 2023
1 parent 1c4e366 commit f0269ea
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions assets/js/_commons/copy-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@

function copyLink(url) {
if (!url || 0 === url.length) {
return;
url = window.location.href;
}

url = window.location.href;

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

$("body").append($temp);
$temp.val(url).select();
document.execCommand("copy");
$temp.remove();

alert("Link copied successfully!");

}
}

0 comments on commit f0269ea

Please sign in to comment.