简体   繁体   English

jQuery中的“ keyup”,“ input”在移动设备浏览器上不起作用

[英]“keyup”, “input” in jquery not working on mobile device browsers

I created a script, it is working on a computer's browser but not on, mobile's browser... 我创建了一个脚本,它可以在计算机的浏览器上运行,但不能在手机的浏览器上运行...

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

I created a script, it is working on a computer's browser but not on, mobile's browser... 我创建了一个脚本,它可以在计算机的浏览器上运行,但不能在手机的浏览器上运行...

You can pass keyup and touchend events into the .on() jQuery method to trigger your code on both of these events Desktop and Touch Devices 您可以将keyuptouchend事件传递到.on() jQuery方法中,以在这两个事件上触发代码台式机触摸设备

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM