JSFiddle - React, Tailwind, and code Playground

HTML

Level 1:
<input type="text" name="benefit_std_level1" maxlength="5" value="0.0" style="width:40px;" class="input nospace">%
<br />Level 2:
<input type="text" name="benefit_std_level2" maxlength="5" value="0.0" style="width:40px;" class="input40 nospace">%
<br />Level 3:
<input type="text" name="benefit_std_level3" maxlength="5" value="0.0" style="width:40px;" class="input nospace">%
<br />

JavaScript

$('.nospace').on('change', function () {
    if(/^\s+$/.test(this.value)) this.value = '0.0';
});