title: object doesn't support this property or method document.querySelector
body: <p>I'm testing one line code on IE7 but it's giving me the following error: </p>
  
  <blockquote>
    <p>Object doesn't support this property or method and it refers to</p>
  </blockquote>
  
  <p>Here's the problem line in question:</p>
  
  <pre><code>var checked = document.querySelector('[name="answer1"]:checked');
  </code></pre>
  
  <p>This is the whole code</p>
  
  <p><strong>Question1 : did you like the training?</strong></p>
  
  <pre><code>&lt;input name="q4" value="Yes" type="radio"&gt; Yes
  &lt;input name="q4" value="No" type="radio"&gt; No
  &lt;br&gt;
  &lt;button id="getval"&gt;cick here&lt;/button&gt;
  
  &lt;script type="text/javascript"&gt; 
  document.getElementById('getval').onclick = function() {
      var checked = document.querySelector('[name="q4"]:checked');
      alert(checked ? checked.value : 'Not selected');
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Is there anyway to fix that?</p>