When I put this in my header:
<script>
function checkiffinished() {
var n = $('.result-row').length;
while (n!==3)
{
n = $('.result-row').length;
$("span").text("There are " + n + " divs.");
};
};
</script>
Then in the body put
<script>
checkiffinished();
</script>
then the page crashes.
The code is supposed to count the number of divs with the "result-row" class and repeat that until the number of divs with aforementioned class is 3.
How can I make it so as such and not crash the page?
EDIT 1: other jQuery I have in the page causes there to be .result-row elements on another event, that's why I need it to check periodically.
EDIT2 : I'm trying to run this in parallel with some other jQuery that manipulates the elements on the page.