如何使用jQuery将TextBox的OnChange事件绑定到函数?
我试着这个和它的失败:
@H_301_4@$(document).ready(function() { $("input#tags").bind("change",autoFill); }); function autoFill() { $("#tags").autocomplete("/taglookup/",{ width: 320,max: 4,highlight: false,multiple: true,multipleSeparator:",",scroll: true,scrollHeight: 300,delay: 10 }); }注意:我想实现一个标签TextBox像stackoverflow的检测OnChange事件和调用AJAX函数时,用户输入。
解决方法
你正在寻找keydown /新闻/ up
@H_301_4@$("#inputID").keydown(function(event) {
alert(event.keyCode);
});
或使用bind $(“#inputID”)。bind(‘onkeydown’,…