Creating a JavaScript function to locate an anchor in a page (specifically with, not an id) and then going through its parent elements until finding one that contains a specified class. The code below works perfectly in Firefox 3.0 but encounters issues with getAttribute in Firefox 3.5 and Internet Explorer 8.
var tab = document.getElementsByName(headerName).item(0);
while (tab.getAttribute('class') != 'card') {
tab = tab.parentNode;
}
While it would be simpler with jQuery, I am limited in my options. How has getAttribute been modified in these newer browsers and how can this issue be resolved?