jquery iterating through newly created elements

Posted by jaeyun on Stack Overflow See other posts from Stack Overflow or by jaeyun
Published on 2010-05-19T00:50:52Z Indexed on 2010/05/19 1:00 UTC
Read the original article Hit count: 254

Filed under:
|
|

Hi All,

I am trying to add new rows in my table, and save them into DB.

First, I use .append() to append rows on the table:

$("#tablename").append("<tr id='newRow'><td>newly added row</td></tr>");

The appending function works fine. My page displays the correct result.

However, I am unable to select them with

$("#newRow").each(function () { alert "it never reaches here!"; });

I am guessing it is because the elements are added after the DOM is loaded. Can anyone please tell me how I can iterate through all my newly added elements?

Thank you.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about iterate