masked input not working in android mobiles?

后端 未结 8 1207
一生所求
一生所求 2020-12-14 15:17

I am using the digitalbush masked input jQuery plugin. It is working fine in web browsers and the iPhone browser perfectly, but it is not working for Android mobile devices.

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 15:46

    This can be a quick fix:

    var ua = navigator.userAgent;
    var isAndroid = /Android/i.test(ua);
    var isChrome = /Chrome/i.test(ua);
    
    // Fix masking on Chrome for mobile devices
    if (isAndroid && isChrome) {
        $('.price_input').attr('type','tel');
    }     
    

提交回复
热议问题