title: HTML - Submit button does not work
body: <p>Please, this code is a search bar that redirects the user to a page according to the word inserted.</p>
  
  <p>But the <strong>submit button does not work</strong> ... only works if the user presses the "Enter" key.</p>
  
  <p>Can anyone help?</p>
  
  <pre><code>&lt;datalist id="mylist"&gt;
      &lt;option value="red"&gt;
      &lt;option value="blue"&gt;
      &lt;option value="black"&gt;
      &lt;option value="white"&gt;
    &lt;/datalist&gt;
  
  
  &lt;!-- Input Colors --&gt;
  &lt;input type="hidden" id="red"  name="red" value="RED" required&gt;
  &lt;input type="hidden" id="blue"  name="blue" value="BLUE" required&gt;
  &lt;input type="hidden" id="black"  name="black" value="BLACK" required&gt;
  &lt;input type="hidden" id="white"  name="white" value="WHITE" required&gt;
  
  
  &lt;!-- Search Bar --&gt;
  &lt;form&gt;
    &lt;input type="search" list="mylist" id="search" placeholder="What Color?" name="search_box" required autocomplete="off"
     onsearch="check(this)"&gt;
    &lt;input type="submit"&gt;
  &lt;/form&gt;
  
  
  
  &lt;script&gt;
  function check(input) 
  
  {
  &lt;!-- Validation Color 1 --&gt;
  if (input.value.toUpperCase() != document.getElementById('red').value)
  {
  &lt;!-- Validation Color 2 --&gt;
  if (input.value.toUpperCase() != document.getElementById('blue').value)  
  {
  &lt;!-- Validation Color 3 --&gt;
  if (input.value.toUpperCase() != document.getElementById('black').value) 
  { 
  &lt;!-- Validation Color 4 --&gt;
  if (input.value.toUpperCase() != document.getElementById('white').value) 
  {
  
  
  &lt;!-- Action web site color WHITE --&gt;
  } 
  else 
  { 
  parent.location.href = 'http://www.websitecolor.com/white'
  }
  
  
  &lt;!-- Action web site color BLACK --&gt;
  } 
  else 
  { 
  parent.location.href = 'http://www.websitecolor.com/black'
  }
  
  
  &lt;!-- Action web site color BLUE --&gt;
  } 
  else 
  { 
  parent.location.href = 'http://www.websitecolor.com/blue'
  }
  
  
  &lt;!-- Action web site color RED --&gt;
  } 
  else 
  { 
  parent.location.href = 'http://www.websitecolor.com/red'
  }
  
  }
  &lt;/script&gt;
  </code></pre>