JSFiddle - React, Tailwind, and code Playground

by igos

HTML

Summary: <input id="summary" type="text" /><br/>
Months:<input class="month" type="text" />
<input class="month" type="text" />
<input class="month" type="text" />
<input class="month" type="text" />
<input class="month" type="text" />
<input class="month" type="text" />
<input class="month" type="text" />
<input class="month" type="text" />
<input class="month" type="text" />
<input class="month" type="text" />
<input class="month" type="text" />
<input class="month" type="text" />
<input id="check" type="text" />

JavaScript

function round(num) {
    return Math.ceil(num * 100) / 100;
}

$("#summary").change(function() {
    var summaryValue = $(this).val();
    var monthCount = $('.month').length;
    
    var remainder = (summaryValue * 100) % monthCount;
    summaryValue = (summaryValue * 100 - remainder + (remainder > 6? 12 : 0)) / 100; 
    
    $(this).val(summaryValue);    
 
    var avarage = round(summaryValue / monthCount);
    
    $('.month').each( function( key, value ) {
		$(this).val(avarage);
    });
    $("#check").val(avarage * monthCount);
});