title: Variable passed to Javascript returns NULL when added to Input Value
body: <p>So, basically I am trying to pass a variable to a piece of javascript code and then in turn set this value as a hidden input value.</p>
  
  <pre><code>&lt;img alt="" src="Image.jpg" style="width:50px" class="thisclass" title="Title" onclick="thisfunction('Text Here')" /&gt;
  </code></pre>
  
  <p>The value clearly passes okay as I am able to process it with a switch command successfully.</p>
  
  <pre><code>function thisfunction(thisvariable) {
      switch(thisvariable) {
          case 'Text Here' :
  </code></pre>
  
  <p>However, when I try to set the value of a hidden </p>
  
  <pre><code>&lt;input type="hidden" name="ThisInput" value="N/A" /&gt;
  
  document.getElementById("ThisInput").value = thisvariable;
  </code></pre>
  
  <p>I get the following error in the javascript console</p>
  
  <pre><code>Uncaught TypeError: Cannot set property 'value' of null
  </code></pre>
  
  <p>I have also tried </p>
  
  <pre><code>$('#ThisInput').val(thisvariable);
  </code></pre>
  
  <p>However this just seems to blank the value.</p>