JSFiddle - React, Tailwind, and code Playground
HTML
<div>
Normally, the hidden input field has attribute `type="hidden"`, but set it as `type="text"` so you can see what happens.
</div>
<input type="text" id="typeHidden" />
<input type="button" id="mybutt" value="Show Me" />
<input type="button" id="nutherbutt" value="Read Hidden Field" />
CSS
div{margin:0 0 20px 0;}
#typeHidden{margin-top:20px;width:200px;height:30px;background:wheat;padding:2px;}
JavaScript
$('#mybutt').click(function(){
$('#typeHidden').val('Secret text');
});
$('#nutherbutt').click(function(){
var tmp = $('#typeHidden').val();
alert( tmp );
});