I am trying to use jQuery UI Autocomplete to open a list of people names in a MySQL database. The main function works - when you enter two or more letters, a list of possible names is displayed, but when I hover over the list or press the down key to access the list, it disappears (2 screenshots below may help explain this).
This means that autocompletion becomes meaningless, as I cannot access the list! If anyone can help, I will be very grateful! Screenshots and code are posted below.
Enter the first few characters and a menu will appear.

But hover or press the down key and it will disappear before you can make a choice.

HTML:
<div id="chooseaccount"> Choose Account to Edit <div id="iechooseaccountlabel" class="labeldiv"> </div> <input type="text" class="inputs" id="editname" placeholder="Enter Student Name" /> </div>
JQuery
$(document).ready(function(){ $("#editname").autocomplete({ source: "names.php", minLength: 2, }); });
PHP:
<?php $mysqli = new mysqli('********', '********', '**********', '*********'); $text = $mysqli->real_escape_string($_GET['term']); $query = "SELECT name FROM users WHERE name LIKE '%$text%' ORDER BY name ASC"; $result = $mysqli->query($query); $json = '['; $first = true; while($row = $result->fetch_assoc()) { if (!$first) { $json .= ','; } else { $first = false; } $json .= '{"value":"'.$row['name'].'"}'; } $json .= ']'; echo $json; ?>
jquery html jquery-ui jquery-ui-autocomplete
Chris Feb 07 '13 at 9:56
source share