?
Solved

Javascript Table Cell elements

Posted on 2003-12-01
3
Medium Priority
?
7,452 Views
Last Modified: 2011-10-03
I have a table like:

<table id="tbl_">
    <!-- Looping multiple rows through code
      i is an increment variable
    -->
    <tr>
         <td><input type="hidden" name="hdn[i]" value="1"</td>
         <td>Hello World</td>
    </tr>
</table>

I want to be able to take a find the name of the hidden input in the table cell 0.  Something like:

alert(tbl_.rows[0].cells[0].elementAt[0].name);

is this possible?
0
Comment
Question by:srobia
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
oktexasguy earned 200 total points
ID: 9854246
srobia-

I'm not sure exactly what you're asking for.  Let me know if this helps or if I missed the boat on this one.

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script>
function doIt(){
var theTable = document.getElementById("tbl_");
alert(theTable.rows[0].cells[0].children[0].value);
}
</script>
</HEAD>

<BODY>
<table id="tbl_">
    <!-- Looping multiple rows through code
      i is an increment variable
    -->
    <tr>
         <td><input type="hidden" name="hdn[i]" value="1"/></td>
         <td>Hello World</td>
    </tr>
</table>

<input type="button" value="show hidden value" onclick="doIt()"/>

</BODY>
</HTML>
0
 
LVL 1

Expert Comment

by:oktexasguy
ID: 9854250
oops- to get what you're after you in the function doIt() you can change

...children[0].value
to
...children[0].name
0
 

Author Comment

by:srobia
ID: 9859108
thanks -- that is exactly what I needed to do!!!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question