title: Javascript error: [elementname] has no properties
body: <p>I'm doing some maintenance coding on a webapp and I am getting a javascript error of the form: "[elementname] has no properties"</p>
  
  <p>Part of the code is being generated on the fly with an AJAX call that changes innerHTML for part of the page, after this is finished I need to copy a piece of data from a hidden input field to a visible input field. 
  So we have the destination field: <code>&lt;input id="dest" name="dest" value="0"&gt;</code>
  <br>And the source field: <code>&lt;input id="source" name="source" value="1"&gt;</code>
  <br>Now when the ajax runs it overwrites the innerHTML of the div that source is in, so the source field now reads: <code>&lt;input id="source" name="source" value="2"&gt;</code></p>
  
  <p>Ok after the javascript line that copies the ajax data to innerHTML the next line is:
  <code>document.getElementById('dest').value = document.getElementById('source').value;</code></p>
  
  <p>I get the following error: <code>Error: document.getElementById("source") has no properties</code></p>
  
  <p>(I also tried <code>document.formname.source</code> and <code>document.formname.dest</code> and same problem)</p>
  
  <p>What am I missing?</p>
  
  <p>Note1: The page is fully loaded and the element exists. The ajax call only happens after a user action and replaces the html section that the element is in.</p>
  
  <p>Note2: As for not using innerHTML, this is how the codebase was given to me, and in order to remove it I would need to rewrite all the ajax calls, which is not in the scope of the current maintenance cycle.</p>
  
  <p>Note3: the innerHTML is updated with the new data, a whole table with data and formatting is being copied, I am trying to add a boolean to the end of this big chunk, instead of creating a whole new ajax call for one boolean. It looks like that is what I will have to do... as my hack on the end then copy method is not working.</p>
  
  <p>Extra pair of eyes FTW.</p>
  
  <p>Yeah I had a couple guys take a look here at work and they found my simple typing mistake... I swear I had those right to begin with, but hey we live and learn...</p>
  
  <p>Thanks for the help guys.</p>