1

現在、jQueryの変更関数を使用しています。変更イベントは、テキストフィールドの外側をクリックしたときにのみ発生します。したがって、テキストボックスにテキストを挿入しても何も起こりませんが、テキストフィールドへのフォーカスを失うとイベントが発生します。いいえ、テキストフィールドの外側をクリックせずにイベントを発生させたいです。

これは私のコードです:

 jQuery("#customfield_10000").change(function(){
            crmAccount = jQuery(this).val();
            alert(crmAccount);
            lijstAccounts = [];

                    jQuery.ajax({
                        url: "http://localhost/papa/jQuery/development-bundle/demos/autocomplete/searchAccounts.php?jsonp_callback=?",
                        dataType: 'jsonp',
                        jsonp: "jsonp_callback",
                        data: {
                            featureClass: "P",
                            style: "full",
                            maxRows: 12,
                            name_startsWith: jQuery(this).val()
                            },
                            success: function( data ) {
                                 jQuery.map( data, function( item ) {
                                                            lijstAccounts.push(item.label);
                                                            jQuery('#customfield_10000').trigger(
                                                                'setSuggestions',
                                                            { result : textext.itemManager().filter(lijstAccounts, query) }
                                                            );              
                                    return {
                                        label: item.label,
                                        value: item.value    
                                    }
                                });
                            }
                        });

             });
4

2 に答える 2

4

input(非IE)またはpropertchange(IEのみ)またはkeyup(ペーストまたはドラッグアンドドロップをキャッチしない)イベントを処理する必要があります。

于 2012-04-18T13:08:46.700 に答える
1

KeyUp イベントを使用できます:

$("#abcd").keyup(function(event) {
     //code
});
于 2012-04-18T13:10:15.467 に答える