View Full Version : Resolved getElementsByTagName and FireFox

11-30-2008, 01:52 AM
I ran into a strange problem that only happens in Firefox but not IE. I am using getElementsByTagName to retrieve my 'input' fields in a function and then performing additional checks on each field with the following code:

var x=document.getElementsByTagName("input");
var i=0;
for (i=0;i<x.length;i++)
if (x[i].type=="radio")

The line that checks to see if the current element is a radio button terminates the function at that point, without any error messages. It appears that using x[i] doesn't work for some reason, since if I hard code it to x[0] then I don't get the error, but then I can only access the first element and I need to loop through and check all elements.

Anyone have any ideas why this doesn't work in FireFox (version 3.0.4)??


11-30-2008, 01:55 AM
Never mind - found my problem. There was some code later that was using x(i) instead of x[i] which was really causing the issue.