views:

59

answers:

2

I have the following scenario

First I get the total rows in my html table with JQuery as follows

var rowCount = $('#update_menu_items tr').length;

and then I get a result back.

Now I want to loop threw values with a for loop that should not exceed the rowcount, but I do not get a result back, since loop does not work. Not sure if I left something out.

Here's the loop

var i;

  for (i=0;i<rowCount;i++)

    alert(i);

  }
+4  A: 

You're missing an open brace:

for (i=0;i<rowCount;i++) { // <- here
    alert(i);
}
Dominic Rodger
:-) true! totally missed it ;-)
Roland
or he has a closing brace where he shouldn't. Depends which way you look at it :)
Andy E
+1  A: 

another approach of loop

$('tr', '#update_menu_items').each(function(row) { alert($row); });

Cem