Can you please guide me on how to fix following issue, or suggest another option for copying to the clipboard?
function click_to_copy_password(containerid) {
if (document.selection) {
var range = document.body.createTextRange();
range.moveToElementText(document.getElementById(containerid));
range.select();
} else if (window.getSelection) {
var range = document.createRange();
range.selectNode(document.getElementById(containerid));
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
}
document.execCommand('copy');
}
It's working fine in Chrome, Firefox & IE, but it does not work in Safari.