title: Javascript - Concatenate Multiple NodeLists Together
body: <p>I was originally asking for an elegant way to simulate the <code>Array.concat()</code> functionality on the results of the <code>getElementsByTagName</code> function in IE or older browsers, because it seemed that <code>concat</code> was not supported. Only, of course it is--the reason the returned object didn't support it is because it isn't an <code>Array</code>. Oops!</p>
  
  <p><code>getElementsByTagName</code> actually returns a <code>NodeList</code>. 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 <code>NodeList</code> would be perfect, too.</p>
  
  <p>Note that I'm using IE6 as this is for a corporate intranet (soon IE8 though).</p>
  
  <p>The answer that I came up with was:</p>
  
  <ul>
  <li><p>It became simpler and probably performed better to just put the code into a separate function and call it three times with the different nodelists, rather than worry about a good way to cram them together into one.</p></li>
  <li><p>I ultimately switched to using MooTools (after several hours reading up on comparisons of all the different frameworks). So now, getting an array of the items I want is very simple. I recommend using a javascript framework like this rather than people beating their brains out trying to figure out the best way to do things. Of course I'm all for actually learning the raw language (which is why I've held off using a framework for so long) but it isn't always the fastest way to get things going, which in a business often matters as much as improving the coder's ability with the language.</p></li>
  </ul>
  
  <p>Update: almost 2 years later I would just use jQuery and be done with it!</p>