Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2008
    Posts
    92
    Thanks
    19
    Thanked 0 Times in 0 Posts

    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

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    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

  • Users who have thanked shyam for this post:

    spetsacdc (07-11-2008)

  • #3
    New Coder
    Join Date
    Mar 2008
    Posts
    92
    Thanks
    19
    Thanked 0 Times in 0 Posts
    Ah thanks!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •