I can not execute the jquerry loop

1

I need to create a loop for msm to feed a graph.

while($(".previsto").eq(0).text(),){}

I need to get these values eq (0), eq (1), eq (2) ...

$(".previsto").eq(0).text(),
$(".previsto").eq(1).text(),
$(".previsto").eq(2).text(),

...

    
asked by anonymous 27.08.2018 / 21:21

1 answer

0

To get indexes of elements (from first to last), the loop variable must begin in 0 to the number of elements -1:

for(var i = 0; i < $(".previsto").length; i++){ 
    console.log($(".previsto").eq(i).text());
}

The $(".previsto").length returns the number of elements with the class .previsto , and the i variable must start from 0 until it is less than $(".previsto").length .

    
27.08.2018 / 22:10