title: Javscript search function working sporadically
body: <p>I have a simple search feature on the products page of my hi fi business. I am somewhat of a rookie developer and have spliced SaaS for the products repository and inserted HTML/CSS/JS, too.</p>
  <p>It sometimes works, it sometimes doesn't.</p>
  <p>What I have noticed is that when I strike enter to search for the item, the URL for the product appears in the address bar, but it doesn't load the page. Console and sources (opera) aren't showing any errors.</p>
  <p>Here's some of my code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;meta name="viewport"
      content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=0, minimum- 
  scale=1.0, maximum-scale=1.0"&gt;
  &lt;title&gt;Tuto&lt;/title&gt;
  &lt;/head&gt;
  
  
  &lt;body style=" background-color: rgb(4, 41, 255);"&gt;
  
  &lt;input type="search" autocomplete="off" value="" placeholder="Search here..." id="search" 
  onchange="openPage()"&gt;
  
  &lt;script&gt;
  function openPage() {
  var x = document.getElementById("search").value;
  
  if (x.toLowerCase() === "Wave".toLowerCase()) {
  window.top.location = ("/Products#!/products/wave-usb---dealer-only---click-for-more-info");
  }
          
  if (x.toLowerCase() === "Wave USB".toLowerCase()) {
  window.top.location = ("/Products#!/products/wave-usb---dealer-only---click-for-more-info");
  }
          
  if (x.toLowerCase() === "Waltz links".toLowerCase()) {
  window.top.location = ("/Products#!/products/waltz-speaker-links");
  }
          
  if (x.toLowerCase() === "Waltz speakerlinks".toLowerCase()) {
  window.top.location = ("/Products#!/products/waltz-speaker-links");
  }
          
  }            
          
  &lt;/script&gt;
  
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>Thank you for your time and stay safe.</p>