No keypress events for certain keys in Android browser

后端 未结 1 1043
礼貌的吻别
礼貌的吻别 2020-12-31 13:02

Below code works perfect in Chrome, Firefox, on IPhone, and even in third-party browsers on Android. However, when run within the native browser key events for special chara

相关标签:
1条回答
  • 2020-12-31 13:37

    i just spent allot of time about this problem. i'm develop to hebrew and all hebrew charters isn't firing event for me.

    i found the solution and i'll give for it short explain before

    when use all key events the browser search for the key you pressing for. cause some reason all charters in other language from english in android native browser is unknown and this is why isn't fire any event when you fill in input charter.

    the solution is to search for event in the input and not on the key. for example if we have in text input .change() method is will be great for us.

    i'm using in addEventListener() method and is working like a charm.

    this is the code

    var exmpleInput = document.getElementById('input-id');
    if(exmpleInput) {
        exmpleInput.addEventListener("input", function() {
            exampleFunction(this)
        }, false);
    }
    
    0 讨论(0)
提交回复
热议问题