user541686
user541686

Reputation: 210755

HTML DOM: Checking if Cell Exists with JavaScript?

Every row has a deleteCell and insertCell method. But how do I see whether a cell exists in the first place?

(A cell may have been deleted by combining it with another cell through rowSpan, and I would like to know if my cell was deleted.)

Upvotes: 0

Views: 1029

Answers (1)

Alnitak
Alnitak

Reputation: 339985

Each HTMLTableRowElement has a cells collection, full of HTMLTableDataCellElement objects.

To find out which cells are missing AFAIK you'll need to iterate through that collection, ensuring that you read the colSpan property of each entry to find out the nominal column number of the next entry.

Upvotes: 2

Related Questions