Alexprom,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(function() {
$('input').on('input', () => updateTotal());
var updateTotal = function () {
var input2 = parseInt($('#tab_id2').val());
var d = h = '';
if (input2) {
d = (500 / input2);
h = (d / 12).toFixed(2);
d = d.toFixed(2);
};
$('#total_id_1').val(d);
$('#total_id_2').val(h);
}
});
</script>
</head>
<body>
500÷<input type="number" id="tab_id2" />=<br>
<output id="total_id_1"></output> гр. <br>
<output id="total_id_2"></output> ХЕ
</body>
</html>