the script is as follows:
<script type="text/javascript">
$(".cpyBtn").click(function () {
$.ajax({
url: '@Url.Action("GetPassword","Credential")',
type: "get",
data: {
idCredential: @Model.ID
},
traditional: true,
cache: false,
success: function (process) {
$("#passDecrypted-" + @Model.ID).val(process);
let copyFrom = document.createElement("textarea");
document.body.appendChild(copyFrom);
copyFrom.textContent = $("#passDecrypted-" + @Model.ID).val();
copyFrom.select();
document.execCommand("copy");
copyFrom.remove();
console.log($("#passDecrypted-" + @Model.ID).val());
}
});
});
</script>
Looking at it with the firefox development tool in console when I click on the icon the following message jumps to me:
document.execCommand ('cut' / 'copy') has been denied because it has not been called from within an event handler generated by the short-running user.