title: Why is chrome throwing error on my JS but works fine in IE FF Android and Safari?
body: <p>I have created an order form of sorts with conditional divs. When a user clicks on a yes/no radio button a new div is to be displayed.
  In all browsers except for chrome it works fine. But in Chrome when a user selects a yes/no radio button, no new div is displayed and console throws the following error </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'style' of null
        at displayQuestion (conditional.js:3)
        at HTMLInputElement.onchange</p>
  </blockquote>
  
  <p>Here is the offending HTML:</p>
  
  <pre><code>&lt;label&gt;
  &lt;input type="radio" id="yestub" name="walltile1" value="yes" 
  onchange="displayQuestion(this.value, 2)" /&gt;Yes
  &lt;/label&gt;
  &lt;label&gt;
  &lt;input type="radio" id="notub" name="walltile1" value="no" 
  onchange="displayQuestion(this.value, 2)" /&gt;No
  &lt;/label&gt;
  &lt;div id="yesQuestion2" style="display:none;"&gt;&lt;br/&gt;
   &lt;!-- some form fields --&gt;
  &lt;/div&gt;
   &lt;div id="noQuestion2" style="display:none;"&gt;&lt;br/&gt;
  Ok Thank you!
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is the related JS:</p>
  
  <pre><code>function displayQuestion(answer, n) {
  
  document.getElementById(answer + 'Question' + n).style.display = "block";
  
  if (answer == "yes") {
  
  document.getElementById('noQuestion' + n).style.display = "none";
  
  } 
  else if (answer == "no") {
  
  document.getElementById('yesQuestion' + n).style.display = "none";
  
  }
  
  }
  </code></pre>
  
  <p>Why is this returning null to chrome but works fine in other browsers?</p>
  
  <p>Also made a fiddle and can't get it to work there..
  <a href="https://jsfiddle.net/fiveonadub/mq7erj9f/3/" rel="nofollow noreferrer">https://jsfiddle.net/fiveonadub/mq7erj9f/3/</a></p>
  
  <p>Can someone please help me to understand what is happening here.</p>
  
  <p>Also I am new to stackoverflow so if I asked this question wrong please tell me how I can do better.</p>
  
  <p>Thank you</p>