It's not a secret anymore!
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
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: 153

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: 63874

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

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

Joined: Aug 06, 2009
Posts: 153

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> ?
It's not a secret anymore!