JSFiddle - React, Tailwind, and code Playground
HTML
Level 1: <input type="text" name="benefit_std_level1" maxlength="5" value="0.0" onblur="noSpaceTest();float_5_2_percent(this);" style="width:40px;" class="input nospace">%<br />
Level 2: <input type="text" name="benefit_std_level2" maxlength="5" value="0.0" onblur="noSpaceTest();float_5_2_percent(this);" style="width:40px;" class="input40 nospace">%<br />
Level 3: <input type="text" name="benefit_std_level3" maxlength="5" value="0.0" onblur="noSpaceTest();float_5_2_percent(this);" style="width:40px;" class="input nospace">%<br />
JavaScript
function noSpaceTest(){
console.log('function has run');
$('.nospace').each(function(){
if ($('.nospace').val() == ' '){
$('.nospace').val('0.0');
}
});
}