Christophe Christophe - 1 year ago 54
HTML Question

Are rows and cells dynamic collections?

In JavaScript, are rows and cells dynamic collections?

For example:

var myRows=myTable.rows;
var newRow=myTable.insertRow();

Will newRow automatically become part of myRows?

Sorry if it seems like a basic question, but I couldn't find any reference with a clear answer.

Answer Source

table.rows is* an HTMLCollection which is live.

An HTMLCollection is a list of nodes. An individual node may be accessed by either ordinal index or the node's name or id attributes.

Note: Collections in the HTML DOM are assumed to be live meaning that they are automatically updated when the underlying document is changed.

* As specified here:

Object HTMLTableElement



This property is of type HTMLCollection.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download