29er
29er

Reputation: 9035

Android/IOS browser. prevent default keyboard from showing on a field focus (Javascript)

I am writing a custom 'component' in javascript, whereas I dont want the native keyboard to pop open while focusing on an input element. Can someone explain the best way to do this ? Thanks!

Upvotes: 0

Views: 2343

Answers (1)

29er
29er

Reputation: 9035

I figured it out. The reason why I am doing this is that the HTML5 'date' input type is very buggy (on Android), and not acceptable for our users. So instead of using the native date, i changed it to a regular input. then on the 'focus' event I stop propogation and immediately blur it: IE:

focus: function(el, evt) {
                evt.stopPropagation();
                this.blur();
                openCustomComponent();
            }

Upvotes: 5

Related Questions