JSFiddle - React, Tailwind, and code Playground
HTML
<p>123tareterterteartert</p>
<div> </div>
<button id="getp">Get Paragraph Width</button>
JavaScript
function showWidth(ele, w) {
$("div").text("hg " + ele +
" is " + w + "px.");
}
$("#getp").click(function () {
showWidth("paragraph", $("p").width());
});