I have a challenge I'm working on that involves two main objectives:
My goal is to distribute the total sum of 3 input values evenly so they add up to 100.
$input1 = $('#input1 '); $input2 = $('#input2 '); $input3 = $('#input3 '); $input1.on('input', function () { $input2 .val(100 - this.value); $input3 .val(100 - this.value - $input2.value) });
Although
$input2
is displaying correctly, it's not passing its value onto$input3
, resulting in NaN.I also attempted creating a callback for input3, but encountered issues with that as well.
I am also trying to figure out how to prevent users from entering numbers outside the range of 0-100.