JSFiddle - React, Tailwind, and code Playground
by jchaplin2
HTML
<div contenteditable="true" id="editable-container">
This text can be edited by the user.
</div>
<button onclick="makeUpperCase()">
Toggle uppercase
</button>
<script>
function makeUpperCase() {
var contentDiv = window.document.getElementById("editable-container");
var contentDivTextTransform = contentDiv.style.textTransform;
if(contentDivTextTransform === "uppercase") {
contentDiv.style.textTransform = "";
} else {
contentDiv.style.textTransform = "uppercase";
}
}
</script>