JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#seccion">prueba</a>
<input type="text" id="inputBox" />
JavaScript
$(document).ready(function() {
$('a[href*=#]').click(function(){
var sHash = $(this).attr('href').replace("#","");
sHash = "box" + sHash.charAt(0).toUpperCase() + sHash.slice(1);
$("#inputBox").val(sHash);
});
});