File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Replace text in the <TD> ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Replace text in the <TD> ?" Watch "Replace text in the <TD> ?" New topic

Replace text in the <TD> ?

Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 146

Hi All ,

I have 2 <TD> with same ID , so I want to change the text in the second TD .

I tried innerHTML but it was replacing first TD's text .

I want to get second TD and change it's text .

Please suggest if anyone has faced such a issue....

Thanks in advance....

- Chetan
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 62501

Having two of the same id values in one page is invalid. Fix that problem.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 146

Yeah completely agreed Bear , But i am working on one product which internally create this type of the structure and is applicable to every screen and every Table TD in it .

But yes i resolved i have one extra hidden field in second TD so i found Parent of that field and then set InnerHTML .

I agree. Here's the link:
subject: Replace text in the <TD> ?