You need to know how many times the phrase (a delay of more than 15 minutes) will be a multiple of 3.
For example, in my code this phrase is found (being more than 15 minutes late) 6 times in the condition I have written that if a number is, for example, 6 == 3, that is, a multiple of 3, then there is a counter that counts the number of times this phrase is multiple, it turns out 2- (6 / 3 = 2).
The problem is that the user can change the lines, namely, to change the phrase (not agreed) for agreed and it turns out that if the delay is agreed then the repeating phrases will not be 6 but 5 because if a delay of more than 15 minutes is agreed == It is agreed that this phrase is roughly subtracted. And it turns out that in the condition we will have 5 == 3, that is, not a multiple of 3 and will be 1 - (5/3 = 1 (if rounded without a residue)).
I do not have enough logic to come up with so that if the phrases were not an even number, then the values ββwould be considered.
var k = 0; jQuery(function($) { //console.log(add()); }); function add() { $('table tr').each(function(row, e) { var col1 = $(e).children('td:nth-child(4)').text(); var col2 = $(e).children('td:nth-child(5)').text(); if (col1 == 'ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π±ΠΎΠ»Π΅Π΅ 15ΠΌΠΈΠ½' && col2 == 'ΡΠΎΠ³Π»Π°ΡΠΎΠ²Π°Π½ΠΎ') { // console.log(col1, col2); return ++k; } }); } add(); //$('span.r1').text('ΠΠΎΠ·ΠΈΡΠΈΠΉ ΡΠΎΠ³Π»Π°ΡΠΎΠ²Π°Π½ΠΎ: ' + k); //Π‘ΡΠ΅ΡΡΠΈΠΊΠΈ Π΄Π»Ρ ΠΏΡΠΎΠ²Π΅ΡΠΊΠΈ Π²Π½ΡΡΡΠΈ ΡΠΈΠΊΠ»Π° var razCounter = 0; var dvaCounter = 0; //Π‘ΡΠ΅ΡΡΠΈΠΊΠΈ Π΄Π»Ρ ΠΏΡΠΈΡΠ²Π°ΠΈΠ²Π°Π½ΠΈΡ ΡΠ΅Π·ΡΠ»ΡΡΠ°ΡΠ° var razResultCounter = 0; var dvaResultCounter = 0; //ΠΡΠ±ΠΎΡΠΊΠ° Π²ΡΠ΅Ρ
ΡΡΠ΅Π΅ΠΊ ΡΠ°Π±Π»ΠΈΡΡ Ρ ΠΊΠΎΠ½ΡΠ΅Π½ΡΠΎΠΌ var razArray = document.querySelectorAll("table td"); //ΠΠ΅ΡΠ΅Π±ΠΎΡ ΡΡΠ΅Π΅ΠΊ for (var i = 0; razArray.length > i; i++) { var currentContent = razArray[i].innerHTML; if (currentContent == "ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π±ΠΎΠ»Π΅Π΅ 15ΠΌΠΈΠ½") { razCounter++; if (razCounter == 3) { razResultCounter++; razCounter = 0; } } else if (currentContent == "ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΠΌΠ΅Π½Π΅Π΅ 15ΠΌΠΈΠ½") { dvaCounter++; if (dvaCounter == 3) { dvaResultCounter++; dvaCounter = 0; } } } $('span.t').text("ΠΠΎΠ»Π΅Π΅ 15 ΠΌΠΈΠ½ ΠΊΡΠ°ΡΠ½Ρ ΡΠΈΡΠ»Ρ 3 : " + razResultCounter); // ΠΡΠΎ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ Π²Π°ΠΆΠ½ΠΎ Π΄Π»Ρ ΡΠ°ΡΡΠ΅ΡΠ°, ΡΡΡ ΠΏΠΎΠΊΠ°Π·ΡΠ²Π°Π΅ΡΡΡ ΡΠΈΡΠ»ΠΎ ΠΊΡΠ°ΡΠ½ΠΎΠ΅ 3 $('span.t1').text("ΠΠ΅Π½Π΅Π΅ 15 ΠΌΠΈΠ½: ΠΊΡΠ°ΡΠ½Ρ ΡΠΈΡΠ»Ρ 3: " + dvaResultCounter); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table border="1" width="1020" cellspacing="0" cellpadding="0"> <tbody> <tr> <td width="230">ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π±ΠΎΠ»Π΅Π΅ 15ΠΌΠΈΠ½</td> <td width="140">Π½Π΅ ΡΠΎΠ³Π»Π°ΡΠΎΠ²Π°Π½ΠΎ</td> </tr> <tr> <td width="230">ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΠΌΠ΅Π½Π΅Π΅ 15ΠΌΠΈΠ½</td> <td width="140">Π½Π΅ ΡΠΎΠ³Π»Π°ΡΠΎΠ²Π°Π½ΠΎ</td> </tr> <tr> <td width="230">ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π±ΠΎΠ»Π΅Π΅ 15ΠΌΠΈΠ½</td> <td width="140">Π½Π΅ ΡΠΎΠ³Π»Π°ΡΠΎΠ²Π°Π½ΠΎ</td> </tr> <tr> <td width="230">ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΠΌΠ΅Π½Π΅Π΅ 15ΠΌΠΈΠ½</td> <td width="140">Π½Π΅ ΡΠΎΠ³Π»Π°ΡΠΎΠ²Π°Π½ΠΎ</td> </tr> <tr> <td width="230">ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π±ΠΎΠ»Π΅Π΅ 15ΠΌΠΈΠ½</td> <td width="140">Π½Π΅ ΡΠΎΠ³Π»Π°ΡΠΎΠ²Π°Π½ΠΎ</td> </tr> <tr> <td width="230">ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π±ΠΎΠ»Π΅Π΅ 15ΠΌΠΈΠ½</td> <td width="140">Π½Π΅ ΡΠΎΠ³Π»Π°ΡΠΎΠ²Π°Π½ΠΎ</td> </tr> <tr> <td width="230">ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π±ΠΎΠ»Π΅Π΅ 15ΠΌΠΈΠ½</td> <td width="140">Π½Π΅ ΡΠΎΠ³Π»Π°ΡΠΎΠ²Π°Π½ΠΎ</td> </tr> <tr> <td width="230">ΠΎΠΏΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π±ΠΎΠ»Π΅Π΅ 15ΠΌΠΈΠ½</td> <td width="140">Π½Π΅ ΡΠΎΠ³Π»Π°ΡΠΎΠ²Π°Π½ΠΎ</td> </tr> <tr> </tbody> </table> <span class="t"></span> <br> <span class="t1"></span> <br> <span class="r1"></span>
data-attributes. Then work with attributes, otherwise when you turn into 15 minutes at 10, damn that day when you wrote this code, especially if you have a lot of it. I have advised you this last time in my opinion. - teran