I have a page that includes an unordered list of links. I'm trying to sort that list alphabetically by the link text. My javascript is working in Firefox and Chrome, but not in IE. IE overwrites the original link text with undefined.
My script first finds the ul tag, then gets all the a links by TagName, and puts them into an array lis. Then comes this loop where I take the link text and put it into a second array vals so I can sort them. I think this is where the problem is happening.
for(var i = 0, l = lis.length; i < l; i++)
vals.push(lis[i].text);
As far as I can tell, IE doesn't think that .text exists. I saw something in a different post that suggested changing it to .text(), but that didn't work in any browser.
How can I get IE to sort my links?