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

jQuery input type text not firing keyup event

如标题所示,我正在尝试将 AJAX 添加到我网站上的搜索框,但没有触发 keyup 事件。我正在使用此消息

中的函数

无论如何这是我的代码

<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">

和js代码

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 );
                }
            });

});
});

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

编辑: parent 元素还有另一个函数。它可以阻止输入功能吗?我在开头添加了 html 代码以便清楚。

$("#search").click(function () {
    if($(this).attr("class")=="search-main"){
        $(this).attr("class","search-main expand");
        $("#autocomplete").attr("placeholder","Lütfen dizi, oyuncu veya tür adı yazın.");
        $("#autocomplete").focus();
    }
    return false;
});

谢谢

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