JSFiddle - React, Tailwind, and code Playground

by Pat Dobson

HTML

<input type="text" class="decimalMe" name="input1" />
<input type="text" class="decimalMe" name="input2" />
        
<a id="clickMe">Click me</a>

JavaScript

$('#clickMe').click(function(){
    $('.decimalMe').each(function(){
        $(this).val( ($(this).val() * 1).toFixed(2) );
    });
});