• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting the TD value using JavaScript + TD does not contain any ID.

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have below table



In the table there are 2 TD tags. The first tag contains the some text value which is number(111,222,333 as displayed in the table), and the second TD contains the checkbox. Now when i click on the checkbox checkboxClicked() function of java script gets called. Now i want to retrieve the value of corresponding first TD's value in the checkboxClicked function. like, when the user click on last checkbox checkboxClicked(3) will be called passing 3 as an argument. and in the checkboxClicked function i want to get the value 444. How do i achieve this ?

Is is possible ? can anybody help me out.

Below is my checkboxClicked function



This table is auto generated by some framework and i have only got the checkboxClicked function to get the data from table.
 
vijin das
Ranch Hand
Posts: 129
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TRY THIS



Even if you are dynamically generating teh values 111 2222 etc write the same value as the value property of the Hidden element ..

just give a try and test it ....

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No actually the whole table is getting generated dynamically. so i can not change anything in the table. As i don't have access to the code which generate the table dynamically, its a framework. If i change the framework for my requirement so many other forms will give errors.
 
vijin das
Ranch Hand
Posts: 129
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jigar Naik wrote:No actually the whole table is getting generated dynamically. so i can not change anything in the table.

ok then whether the values 111 222 333 444 are only there ..or will it change on any circumstances ?..
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya they will change whenever the page is loaded, basically they are coming from the database.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Eric
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Eric, it worked.



Thanks vijin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic