jQuery输入类型文本没有触发keyup事件

时间:2016-03-27 22:20:43

标签: jquery textbox

正如在标题中我试图在我的网站上添加AJAX到搜索框但是没有触发键盘事件。我正在使用此消息中的函数https://stackoverflow.com/a/17317620/5690756

无论如何,这是我的代码

        Waf: Entering directory `/home/mptcp/build'
        Waf: Leaving directory `/home/mptcp/build'
        source not found: 'model/mp-tcp-onoff-application.cc' in 

bld(features=['cxx', 'cxxshlib', 'ns3module'], 

ns3_dir_location='src/applications', pcfilegen=bld(features='ns3pcfile', 

idx=2, meths=[], prec=defaultdict(<type 'list'>, {}), _name='', source='', 

module='ns3-applications', mappings={}, path=/home/mptcp/src/applications, 

target='') in /home/mptcp/src/applications, use=['ns3-internet', 'ns3-

config-store', 'ns3-stats', 'ns3-mptcp'], mappings={}, uselib='', meths=

['_add_test_code', 'apply_bundle', 'process_rule', 'process_source', 

'apply_link', 'apply_implib', 'process_use', 'propagate_uselib_vars', 

'apply_incpaths', 'apply_vnum', 'set_macosx_deployment_target'], 

prec=defaultdict(<type 'list'>, {}), source=['model/bulk-send-

application.cc', 'model/onoff-application.cc', 'model/packet-sink.cc', 

'model/ping6.cc', 'model/radvd.cc', 'model/radvd-interface.cc', 

'model/radvd-prefix.cc', 'model/udp-client.cc', 'model/udp-server.cc', 

'model/seq-ts-header.cc', 'model/udp-trace-client.cc', 'model/packet-loss-

counter.cc', 'model/udp-echo-client.cc', 'model/udp-echo-server.cc', 

'model/v4ping.cc', 'model/application-packet-probe.cc', 'helper/bulk-send-

helper.cc', 'helper/on-off-helper.cc', 'helper/packet-sink-helper.cc', 

'helper/ping6-helper.cc', 'helper/udp-client-server-helper.cc', 

'helper/udp-echo-helper.cc', 'helper/v4ping-helper.cc', 'helper/radvd-

helper.cc', 'model/mp-tcp-packet-sink.cc', 'model/mp-tcp-bulk-send-

application.cc', 'model/mp-tcp-onoff-application.cc', 'helper/mp-tcp-

packet-sink-helper.cc', 'helper/mp-tcp-bulk-send-helper.cc'], test=False, 

is_ns3_module=True, install_path='${LIBDIR}', module_deps=['internet', 

'config-store', 'stats', 'mptcp'], dependencies=['internet', 'config-

store', 'stats', 'mptcp'], path=/home/mptcp/src/applications, vnum=None, 

posted=True, is_static=False, target='../../ns3.19-applications-debug', 

idx=1, _name='ns3-applications') in /home/mptcp/src/applications

和js代码

<nav id="search" class="search-main">
    <div class="search-trigger"></div>
    <div class="search-general">
        <div class="search-close"></div>
        <input type="text" value="" id="autocomplete" name="s" class="search-input ui-autocomplete-input" placeholder="Arama" autocomplete="off">
        <input type="button" class="search-button">

警报功能在我的代码中不起作用我怎么能解决这个问题我不知道。

编辑: 我有另一个父元素的功能。它是否可以阻止输入功能,我也将html代码添加到开头以便清楚。

jQuery(document).ready(function($) {
$("#autocomplate").on('change keyup paste', function() {
    alert("Girdim");
    var lastValue = $("#autocomplate").val();
            jQuery.ajax({
                type : 'post',
                url : helper.ajaxUrl,
                data : {action : 'load_search_results',query : lastValue
                },
                beforeSend: function() {
                    $(this).prop('disabled', true);
                },
                success : function( response ) {
                    $(this).prop('disabled', false);
                    $('#modal_results').html( response );
                }
            });

});
});

由于

1 个答案:

答案 0 :(得分:2)

您错误输入autocomplate它与ID autocomplete不匹配。