Dynamic HTML Table Example

A dynamic HTML table created by JavaScript.

Dynamic HTML Table

What makes this dynamic?

The table itself is generated by JavaScript.

The table can be amended using the form hidden by the details element.

The table caption and locating id can be amended using the form.

To amend the table details, the jsondata textarea input data needs to be changed.

JSON Format

The expected JSON format for the table is an array of row objects.

Each row object should have name and age fields.

e.g.

[{"name" : "row 1 name", "age" : 20}, {"name": "row 2 name", "age" : 432}]

JavaScript Execution

You could also populate the table by calling the javascript function createTableFromJson.

This takes three arguments:

Help keep this site free by joining our Patreon Membership site. Membership costs as little as $1 a month and includes access to exclusive e-books and online training courses.