【问题标题】:"keyup", "input" in jquery not working on mobile device browsersjquery中的“keyup”,“input”在移动设备浏览器上不起作用
【发布时间】:2018-11-24 14:22:59
【问题描述】:

我创建了一个脚本,它可以在计算机的浏览器上运行,但不能在移动浏览器上运行...

<input type="text" placeholder="Mobile Number"  id="Email" 
       oninput="this.className = ''" name="email" required>
<span id="email_status"></span>

$(document).ready(function(){
    $('#Email').on('keyup input', function(){ 
        var email = $(this).val();
        $.ajax({
            type: 'post',
            url: 'availibility_email.php',
            data: {
                email:email,
            },
            success: function (response) {
                $( '#email_status' ).html(response);
            }
        });
    });
});

我创建了一个脚本,它可以在计算机的浏览器上运行,但不能在移动浏览器上运行...

【问题讨论】:

  • 究竟是什么东西可以在电脑上运行,但不能在手机上运行?
  • Javascript 可以在电脑上运行,但不能在移动设备上运行...@peeebeee
  • 脚本不起作用怎么办?您期望的行为是什么,而不是发生了什么? (请看How to Ask

标签: javascript jquery ajax input onkeyup


【解决方案1】:

您可以将keyuptouchend 事件传递给.on() jQuery 方法,以在这两个事件DesktopTouch 上触发您的代码设备

$('#Email').on('keyup touchend', function(){
  //code
});

【讨论】:

    猜你喜欢
    • 2018-07-17
    • 1970-01-01
    • 2019-04-26
    • 1970-01-01
    • 2020-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-23
    相关资源
    最近更新 更多