title: How to redirect selected list correctly
body: <p>I got a few issue with my input- and I'm using <a href="http://leaverou.github.io/awesomplete" rel="nofollow noreferrer">awesomplete autocomplete plugin</a> the issue is with my function..if I clicked input before selected text then my page is redirecting..for example type a <code>Fa</code> and don't select text only click on input and you are gonna see how my page is redirecting</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-js lang-js prettyprint-override"><code>$(document).ready(function(){
    
          if (!$("#srehberText").length) return false;
          var input = document.getElementById("srehberText");
  
      // Show label but insert value into the input:
      new Awesomplete(input, {
          list: [
              { label: "&lt;img src='https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRUxdD-Q4nIx3uIg9jBCe1oT5a9MHuWY5_pW4FoZSU-nQd1Y_WJPQ'/&gt; Facebook", value: "https://www.facebook.com/" },
              { label: "&lt;img src='https://hydra-media.cursecdn.com/dota2.gamepedia.com/thumb/2/25/Pounce_icon.png/16px-Pounce_icon.png?version=77c984fc4a9c8ca491ead081322fa738'/&gt; Youtube", value: "https://www.youtube.com/" },
              { label: "China", value: "CN" },
              { label: "United States", value: "US" }
          ]
      });
  
  
  
      
      // You can search for a better version
   $(document).find('.awesomplete').on('click', function(e) {
    if ($('#srehberText').val())
      window.location = $('#srehberText').val();
    //console.log($('#myinput').val());
  });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>input{
    padding:15px;
    width:300px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://cdnjs.cloudflare.com/ajax/libs/awesomplete/1.1.1/awesomplete.min.css" rel="stylesheet"/&gt;
  
  &lt;input id="srehberText" /&gt;
  
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/awesomplete/1.1.1/awesomplete.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>