javascriptjquerykeyboardvirtualmobiscroll

Hide virtual keyboard on mobile with Jquery/Javascript (Mobiscroll)


There are a lot of questions about this. But they all talk about leaving the focus on a field. Here is my problem:

I have a input type field. When the user clicks on it, it will open my custom mobiscroll feature. and in some cases like by Android 2.* or windows surface tablets it shows the virtual keyboard as well ! How can i code a case that the virtual keyboard will never appear !

Who can help me :)


Solution

  • Blur was the key for my issue ! Mobiscroll has a method called onBeforeShow that gets called before the mobiscroll appears. In this method I used blur() on the input type i used the mobiscroll on ! My code below:

    var options = {
            preset: this.preset,
            theme: 'wp light',
            mode: 'scroller',
            display: 'bottom',
            timeWheels: "HHii",
            dateFormat: "dd-mm-yy",
            timeFormat: "HH:ii",
            lang: 'nl', // TODO: Deduce from application language.
            onBeforeShow: (html, inst) => { this.findControl().blur();}
        };
        this.findControl().mobiscroll(options);