JSFiddle - React, Tailwind, and code Playground
HTML
<input type="number" name="first" min="0" step="1" class="input_num" placeholder="0" />
<input type="number" name="second" min="0" step="1" class="input_num" placeholder="0" />
JavaScript
const one = 100;
const input = document.querySelectorAll('.input_num').length;
document.addEventListener('input', event => {
if (event.target.classList.contains('input_num')) {
const num = one / input;
if (event.target.value > num) {
event.target.value = num;
event.target.max = num;
}
}
})