<html>
<head>
<script type="text/javascript">
var emails=[{name:"Lucy",id:1},{name:"Tom",id:2}];
$("#tagID").val();
$("#tag").autocomplete(emails,{
minChars: 0,
width: 210,
matchContains: true,
autoFill: false,
mustMatch:true,
selectFirst:true,
formatItem: function(row, i, max) {
return row.name;
},
formatMatch: function(row, i, max) {
return row.name;
},
     formatResult: function(row) {
return row.name;
}
}).result(function(event, item) {
if(item){
$("#tagID").val(item.id);}
else{$("#tagID").val("");}
})
</script>
</head>
<body>
    <label>
        tag:</label>
    <input type="text" id="tag" />
    <input type="text" id="tagID" />
</body>
</html>autocomplete只输入触发事件