Jump to content

Assign <TD> ID to a Javascript Variable


dlebowski

Recommended Posts

you will want to use document.getElementById("test1") to reference the table cell, and use one of the appropriate properties for that object to access its value. it'll most likely be innerHTML that you're looking to use.

So this should technically work.  Correct?  I know very little about javascript.

 

Thank you for the quick reply.  I don't think I have it right, but here is what I have.

 

var name = document.getElementById('test1').innerHTML;
document.write(name);

if you're not calling that chunk of code after updating the <td> element with AJAX, then it won't have a value, because the element's innerHTML hasn't been updated yet. it would be helpful to see the whole script if you want more help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.