JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="shipping:firstname" name="billing[firstname]" value=""/>
JavaScript
var text_to_get='firstname';
var targetID = '#shipping\\:' + text_to_get;
$(targetID).val("10");