How to copy CSS RTL directional format to clipboard?
I got this text on the clipboard: moc.liam@liam , but I want this: mail@mail.com
Using this code to copy:
<script>
function CopyKey(elementId) {
var aux = document.createElement("input");
aux.setAttribute("value", document.getElementById(elementId).innerHTML);
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
}
</script>
<p id="key" class="rev" onclick="CopyKey('key')">moc.liam@liam</p>
.rev {
unicode-bidi: bidi-override;
direction: rtl;
}
EDIT (WORK CODE)
function Reverse(s){
return s.split("").reverse().join("");
}
function CopyKey(elementId) {
var aux = document.createElement("input");
aux.setAttribute("value", Reverse(document.getElementById(elementId).innerHTML));
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
}
source
share