I have table rows that have a start number and an end number (input fields).
In the line, the line must be larger than the beginning.
From the entrance from left to right, from top to bottom, the numbers should be larger than the last.
So, there are 2 entries per line and 4 (for example) lines. Each number is greater than the last.
I am trying to verify this using this function
var maxDepth = 0,
didValidate = true;
$('.input-start-depth, .input-end-depth').each(function(i) {
maxDepth = Math.max(maxDepth, parseFloat($(this).val(), 10));
var isStart = ($(this).hasClass('input-start-depth'));
var value = $(this).val();
if (isStart && value > maxDepth) {
didValidate = false;
return false;
};
lastValue = value;
});
I rack my brains to make it work. Another important thing - the number of lines is dynamic, it can be 1 or 10,000 or any intermediate.
Basically, this means that if the depth of the beginning is greater than the maximum depth, it should fail.
But he checks the numbers when they should not be valid.
What am I doing wrong?
Greetings.