Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-10-2008, 08:36 PM   PM User | #1
spetsacdc
New Coder

 
Join Date: Mar 2008
Posts: 92
Thanks: 19
Thanked 0 Times in 0 Posts
spetsacdc is an unknown quantity at this point
Basic DOM traversing (Jquery)

Hi, I have a table like this:

Code:
<table>
   <tr>
       <td><a>moose.jpg</a></td>
       <td>16kb</td>
       <td><a>delete</a></td>
   </tr>
</table>
The row is passed to a function via an onclick event using this script: http://www.frequency-decoder.com/200...actions-script.

It is for a file browser. I need to get the text from the first td in the row (the file name).

I can get the text for the entire row, but not only the first td.

Code:
function rowSelectCallback(details){
		var all_tds = $j(details.row).children('td').text();
		alert(all_tds);
		return true;
	  }
This alerts moose.jpg16kbdelete

Any ideas how to only get moose.jpg?

Thanks
spetsacdc is offline   Reply With Quote
Old 07-11-2008, 05:08 PM   PM User | #2
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
Code:
$j(details.row).children('td:first').text();
__________________
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
shyam is offline   Reply With Quote
Users who have thanked shyam for this post:
spetsacdc (07-11-2008)
Old 07-11-2008, 05:11 PM   PM User | #3
spetsacdc
New Coder

 
Join Date: Mar 2008
Posts: 92
Thanks: 19
Thanked 0 Times in 0 Posts
spetsacdc is an unknown quantity at this point
Ah thanks!
spetsacdc is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 10:55 PM.


Advertisement
Log in to turn off these ads.