Length of an HTMLObjectCollection is incorrect in Internet Explorer

Posted by Mayank Gupta on Stack Overflow See other posts from Stack Overflow or by Mayank Gupta
Published on 2012-09-06T09:27:17Z Indexed on 2012/09/06 9:38 UTC
Read the original article Hit count: 175

Filed under:

I have three cells in different rows in a table having same name.e.g.

<td name = "x">

is present in 3 different rows.

I am using document.getElementsByName() to obtain a collection of these cells and trying to calculate the length of this collection. e.g.

var obj = doucment.getElementsByName("X");
  var length = obj.length;

This code works fine in Google Chrome but in IE the length is return as 0(zero).

Can anyone tell me how to sove this problem in IE?

© Stack Overflow or respective owner

Related posts about JavaScript