<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>autocomplete demo</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
</head>
<body>
<input type="text" name="varGlnText" id="varGlnText" value=""/>
<select name="intGlnID" name="intGlnID" id="id_n" onchange="document.getElementById('ChooseGLNForm') .submit()">
<option value=2547>Иванов</option>
<option value=7458>Петров</option>
<option value=8521>Сидоров</option>
</select>
<script>
var sel = $("#id_n")[0];
$( "#varGlnText" ).autocomplete({
select: function(event, ui) { sel.value = ui.item.indx } ,
source: function( request, response ) {
response($.map(sel.options, function(item) {
return {
label: item.text,
value: item.text,
indx: item.value
}
}))
},
matchContains: 1
});
</script>
</body>
</html>