Get a href from specific table cell without id using Javascript-Collection of common programming errors
Try this if you have “a” element inside the cell
document.getElementsByTagName("a")[0].getAttribute("href");
or if you want to set attribute
document.getElementsByTagName("a")[0].setAttribute("href", "somelink.com");
something like this might work..its hard to help cause you dont provide some code to know what you are trying to do
var links = document.querySelector("table tr td:last-child");
for (var i = 0; i < links.length; i++)
{
links[i].setAttribute("href", "somelink.com");
}
Originally posted 2013-11-19 13:18:47.