I am creating a javascript function that would find an anchor in a page (specifically with , not an id) and then iterate through the parents of it until it reached one that contains a certain class. I used the following code and it works fine in Firefox 3.0 but fails at getAttribute in both Firefox 3.5 and Internet Explorer 8.
var tab = document.getElementsByName(headerName).item(0);
while (tab.getAttribute('class') != 'card') {
tab = tab.parentNode;
}
I know this would be easy in jQuery but I am highly constrained. How has getAttribute been changed in these new browsers and what can I do to fix this?