我想就与属性“kolonadi”Jquery自动完成后按下第二个键运行?
当我按在文本框的主要使用每个文本框自动完成工作,页面提醒我“的keydown enterance”,但自动完成未运行。如果我再按一个键,它就可以正常工作。
我该如何修改此代码?
这是我的动态输入:
<input name="ctl00$MainContent$qtxt_UNVAN" type="text" id="MainContent_qtxt_UNVAN" class="textEntry2 ui-autocomplete-input" kolonadi="UNVAN" style="width:200px;" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true">
这是jQuery的自动完成:
$('.textEntry2').keydown(function() {
alert("keydown enterance");
var kolonadi_ = $(this).attr("kolonadi");
$(this).autocomplete({
source: function (request, response) {
$.ajax({
url: '<%=ResolveUrl("~/AutoCom.asmx/GetValues") %>',
data: "{ 'word': '" + request.term + "','KullaniciIndexInGlob':'<%=KullaniciIndexInGlob %>','BaslikId':'<% =BaslikId %>','columnName':'" + kolonadi_ + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
}
}))
},
error: function (response) {
alert(response.responseText);
},
failure: function (response) {
alert(response.responseText);
}
});
},
select: function (e, i) {
$("#<%=hfCustomerId.ClientID %>").val(i.item.val);
},
minLength: 1
});
});
这个插件的文档是[这里](http://www.jqueryui.com/demos/autocomplete)。他们都没有建议在keydown上应用这个widget。我会访问该页面并查看示例。 – 2012-01-08 22:25:38