Help Me Fix This | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
2 Answers
+ 1
Try using this code in input event on change input.addEventListener("change", function() { var inputVal = parseInt(input.value); var selectVal = parseInt(select.value); if (inputVal < selectVal) { pieces.value = inputVal; stacks.value = 0; } else { stacks.value = Math.floor(inputVal / selectVal); pieces.value = inputVal % selectVal; } if (input.value === "") { input.value = 0; pieces.value = 0; stacks.value = 0; } }); https://code.sololearn.com/WphScKa5bfSC/?ref=app
1st Sep 2023, 10:48 AM
Mohammed Nihal
Mohammed Nihal - avatar
0
It's lagging when I trying put a number like 999999 or 9999999 higher in input element it's lagging
1st Sep 2023, 9:45 AM
Leonard