当从菜单中选择一个项目时触发; ui.item引用所选项目。 select的默认操作是将文本字段的值替换为所选项目的值。取消此事件可防止更新该值,但不会阻止菜单关闭。如何防止自动完成中的默认选择事件jquery
$("#txt1").autocomplete({
minLength: 1,
source: "abc.php",
select: function(event, ui)
{
event.preventDefault();
//alert("Select");
var label= ui.item.label;
var value= ui.item.value;
$('#txt1').val(ui.item.label);
}
});
你有没有想办法? – 2012-11-13 16:57:04