title: jQuery UI Autocomplete - menu disappears on hover
body: <p>I'm trying to use jQuery UI Autocomplete to bring up a list of names of people in a MySQL Database. The basic function is working - when you type in two or more letters a list of possible names is displayed - but when I hover the mouse over the list or press the down key to access the list, it disappears (2 screenshots below may help to explain this).</p>
  
  <p>What this means is that the Autocomplete becomes pointless as I can't actually access the list! If anyone can help I'd be most appreciative! Screenshots and code are posted below.</p>
  
  <p><em>Type in the first few characters and the menu appears</em></p>
  
  <p><img src="https://i.stack.imgur.com/usNKc.png" alt="Screenshot 1"></p>
  
  <p><em>But hover the mouse or press the 'down' key and it disappears before a selection can be made</em></p>
  
  <p><img src="https://i.stack.imgur.com/U9DJT.png" alt="Screenshot 2"></p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>  &lt;div id="chooseaccount"&gt;
    Choose Account to Edit
    &lt;div id="iechooseaccountlabel" class="labeldiv"&gt;
      &lt;!--[if IE]&gt;
       Enter Student Name
      &lt;![endif]--&gt;
     &lt;/div&gt;
  
    &lt;input type="text" class="inputs" id="editname" placeholder="Enter Student Name" /&gt;
  
    &lt;/div&gt;
  </code></pre>
  
  <p><strong>jQuery:</strong></p>
  
  <pre><code>$(document).ready(function(){
  
  $("#editname").autocomplete({
   source: "names.php",
   minLength: 2,
  });
  
  });
  </code></pre>
  
  <p><strong>PHP:</strong></p>
  
  <pre><code>&lt;?php  
  
  $mysqli = new mysqli('********', '********', '**********', '*********');
  $text = $mysqli-&gt;real_escape_string($_GET['term']);
  
  $query = "SELECT name FROM users WHERE name LIKE '%$text%' ORDER BY name ASC";
  $result = $mysqli-&gt;query($query);
  $json = '[';
  $first = true;
  while($row = $result-&gt;fetch_assoc())
  {
  if (!$first) { $json .=  ','; } else { $first = false; }
  $json .= '{"value":"'.$row['name'].'"}';
  }
  $json .= ']';
  echo $json;
  
  ?&gt;  
  </code></pre>