JSFiddle - React, Tailwind, and code Playground

HTML

<body id="index">
    <p >test</p>
    <input id="inp" type="text"></input>
</body>

JavaScript

$("#inp").val($("#index").length);