Monday, October 30, 2006

Changing innerHTML of table row

Few days ago, I got stuck while replacing the innerHTML of a table row with the results from an AJAX call. It happened that IE doesn't support the replacement of contents of a table row, while Firefox and Mozilla allows it.

Googling on the problem, I found that for IE you need to remove all the cells using deleteCell() method. Then create new cell using insertCell() method and then replace the innerHTML of this newly added cell.

So, for replacing the contents of Table in IE you need to iterate over the rows and cells and then replace the content of each cell individually.

For more info:

No comments: