JSFiddle - React, Tailwind, and code Playground
by Zhuoyu Qian
HTML
<head>
<title>TEST</title>
</head>
<body style="font-size: 0.8em">
<div id="elm" contenteditable="true">aa</div>
<button onclick="rightText()">right</button>
</body>
JavaScript
function rightText()
{
var elm = document.querySelector('#elm');
elm.focus();
document.execCommand('justifyRight', false, 'justifyRight');
}