0

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);

  }

2 Answers 2

4

You're missing an open brace:

for (i=0;i<rowCount;i++) { // <- here
    alert(i);
}
Sign up to request clarification or add additional context in comments.

2 Comments

:-) true! totally missed it ;-)
or he has a closing brace where he shouldn't. Depends which way you look at it :)
1

another approach of loop

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.