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 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Specific cell ID content

    Hey guys, this is probably a newbie question, but I've searched on google and didn't really find something that worked for me.
    I got some rows as a result of a search query. These rows all have an unique id: row_[rownr] (for example: row_1, row_2, etc) and these rows all have some cells in it, but only one of them has an id and I want the contents of the td with that id. If this isn't possible or very hard than I can change the id to a class if that makes life easier.

    What I got:

    PHP Code:
    // nr is passed with the function call to select the right row
    var document.getElementById("row_" nr);

    // I want the content of the cell with the part_nr id
    var r.getElementById("part_nr");

    // show the contents
    alert("content: " c.innerText); 
    This obviously isn't working, who can help me out here?
    Thanks!

    'x.

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    972
    Thanks
    19
    Thanked 212 Times in 210 Posts
    Quote Originally Posted by Pattatj View Post
    Hey guys, this is probably a newbie question, but I've searched on google and didn't really find something that worked for me.
    I got some rows as a result of a search query. These rows all have an unique id: row_[rownr] (for example: row_1, row_2, etc) and these rows all have some cells in it, but only one of them has an id and I want the contents of the td with that id. If this isn't possible or very hard than I can change the id to a class if that makes life easier.

    What I got:

    PHP Code:
    // nr is passed with the function call to select the right row
    var document.getElementById("row_" nr);

    // I want the content of the cell with the part_nr id
    var r.getElementById("part_nr");

    // show the contents
    alert("content: " c.innerText); 
    This obviously isn't working, who can help me out here?
    Thanks!

    'x.
    Every id must be unique, then just
    document.getElementById( uniqueId );

  • Users who have thanked DaveyErwin for this post:

    Pattatj (09-26-2011)


  •  

    Posting Permissions

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