I'm using the following function to copy to clipboard.
function CopyToClipboard(containerid) {
if (document.selection) {
var range = document.body.createTextRange();
range.moveToElementText(document.getElementById(containerid));
range.select().createTextRange();
document.execCommand("copy");
} else if (window.getSelection) {
var range = document.createRange();
range.selectNode(document.getElementById(containerid));
window.getSelection().addRange(range);
document.execCommand("copy");
swal("Signature copied!","Successfully copied to clipboard.", "success");
}}
I'm updating links using an input form (js example shown below). The copy function doesn't work when the links get updated.
$('#fbInput').on('input',function(e){
var fbInput = $('#fbInput').val();
textFB.attr("href", fbInput);
if(fbInput.length > 5 && fbInput.includes("http") !== true) { swal("Include HTTPS.","Start your URL with https://", "warning"); }
});
Please advise.