Javascript - Concatenate Multiple NodeLists Together

Posted by Emtucifor on Stack Overflow See other posts from Stack Overflow or by Emtucifor
Published on 2010-03-12T02:29:17Z Indexed on 2010/04/27 22:23 UTC
Read the original article Hit count: 355

I was originally asking for an elegant way to simulate the Array.concat() functionality in IE or older browsers, because it seemed that concat was not supported. Only, of course it is and the reason the object didn't support it is because it wasn't an array. Oops!

getElementsByTagName returns a NodeList, not an array. The real question, then, is: what's a good way to get a single list of all the form elements in a document (input, select, textarea, button) to loop through them? An array isn't required... a single NodeList would be perfect, too.

Note that I'm using IE6 as this is for a corporate intranet (soon IE8 though).

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about nodelist