JSFiddle - React, Tailwind, and code Playground

by stevea

HTML

<input type="button" onmousedown="reportColourAndFontSize(); return false" value="Get colour and font size">

<div contenteditable="true"><font size="5">Large text</font> and <span style="color: red">red text</span></div>

JavaScript

function reportColourAndFontSize() {
    var colour = document.queryCommandValue("ForeColor");
    var fontSize = document.queryCommandValue("FontSize");
    alert("Colour: " + colour + ", font size: " + fontSize);
}