重複の可能性:
jQueryオートコンプリートトリガー変更イベント
jQuery UI v1.9を使用していて、jQueryUIオートコンプリートウィジェットを正常に実装しました。jQuery UIイベントをトリガー/バインドできるかどうか、可能であれば、その方法を知りたいです。つまり、たとえば、私が持っている場合
$('#autocomplete_field" %>').autocomplete({
change: function (event, ui) {
// Make something...
},
minLength: 2,
...
});
jQuery UIchange
イベントをイベントにバインドして実行することは可能keypress
ですか?
注:試しました
$('#autocomplete_field').bind('keypress', function(event) {
$('#autocomplete_field').autocomplete('option', 'change').call();
});
しかし、次のエラーが発生します(Firebugコンソールから):
TypeError: elem.nodeName is undefined
...ks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase(...