JSFiddle - React, Tailwind, and code Playground

HTML

<div class="test"><span>111</span></div>
<input type="text" id="forma" value="0">

JavaScript

$(".test span").on("change click",function(){
 $('#forma').val($(".test span").text());
});