JSFiddle - React, Tailwind, and code Playground
by John Doe
HTML
<label for="name">Your age</label>
<input id="name" name="name" /><br />
<label for="height">Your height</label>
<input id="height" name="height" />
JavaScript
$('input').val(function(){
return $('label[for=' + this.id + ']').hide().text();
});