Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Get Table Cell Value using Javascript

Reply
Thread Tools

Get Table Cell Value using Javascript

 
 
=?Utf-8?B?Qw==?=
Guest
Posts: n/a
 
      04-23-2007
How do I get the text from my cell e..g. <td>Test Text</td>



var elTableCells = elTableRow.getElementsByTagName("td");

alert(elTableCells[0].innerText);

 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      04-23-2007
The easiest way to get a particular cell is to give it an ID, of course. You
then do not have to play any games. Even if you are binding, you can do this
by adding IDs during the data binding event. You can add IDs and even add
events if a person clicks a cell. It takes slightly longer to render, but it
is easier than searching through the haystack later.

If this is not an option, you will have to go through finding the table and
then iterating through rows to find the particular cell. This tutorial shows
how to create a table, but the basic process of iterating through cells is
the same:
http://developer.mozilla.org/en/docs...DOM_Interfaces

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*********************************************
Think outside the box!
*********************************************
"C" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How do I get the text from my cell e..g. <td>Test Text</td>
>
>
>
> var elTableCells = elTableRow.getElementsByTagName("td");
>
> alert(elTableCells[0].innerText);
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get Table Cell value using Javascript =?Utf-8?B?Qw==?= ASP .Net 5 07-25-2012 02:45 PM
get Table cell value Sunny Javascript 3 10-20-2008 04:58 PM
Get 2nd cell value from table row? harry Javascript 2 07-22-2004 01:34 PM
How do I have a table cell fetch another page to display within the cell? Phillip Roncoroni HTML 14 04-05-2004 05:58 PM
get a table cell value yukatan Javascript 2 11-06-2003 11:52 PM



Advertisments