Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

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 09-23-2011, 03:29 PM   PM User | #1
Pattatj
New Coder

 
Join Date: Sep 2011
Posts: 13
Thanks: 2
Thanked 0 Times in 0 Posts
Pattatj is an unknown quantity at this point
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.
Pattatj is offline   Reply With Quote
Old 09-24-2011, 02:13 PM   PM User | #2
DaveyErwin
Regular Coder

 
Join Date: Aug 2010
Posts: 810
Thanks: 12
Thanked 168 Times in 166 Posts
DaveyErwin is on a distinguished road
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 );
DaveyErwin is offline   Reply With Quote
Users who have thanked DaveyErwin for this post:
Pattatj (09-26-2011)
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 11:46 AM.


Advertisement
Log in to turn off these ads.