title: Showing Uncaught TypeError: Cannot set property 'selected' of null
body: <blockquote>
    <p>Showing Uncaught TypeError: Cannot set property 'selected' of null</p>
  </blockquote>
  
  <pre><code>    &lt;select id="sorter" class="sorter-options"&gt;                                                             
      &lt;option value="name"&gt;Product Name &lt;/option&gt;
      &lt;option value="price"&gt;Price&lt;/option&gt;
      &lt;option value="sort_by"&gt;Scale&lt;/option&gt;
      &lt;/select&gt;
  
  
     &lt;script type="text/javascript"&gt;
      var val = '';    
      document.querySelector('#sorter [value="' + val + '"]').selected =  true;
     &lt;/script&gt;
  </code></pre>