/

HTML / CSS / JavaScript Tutorial

JavaScript tr object method: insertCell()

[this page | pdf | back links]

The insertCell() method of the JavaScript DOM object corresponding to the HTML <tr> element inserts a cell into a table row.

 

It has the following syntax with the following parameters:

 

object.insertCell(index)

 

Parameter

Required / Optional

Description

index

Required (see below)

Index position where cell is to be inserted (index starts at 0). Using zero sometimes inserts a new cell at the start and sometimes at the end depending on browser. Using -1 inserts after the end of the existing last row.

 

Note: the index parameter is required by some browsers but optional for others.

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile