iphone keyboard not hiding when tapping the screen

后端 未结 7 1069
小鲜肉
小鲜肉 2021-02-07 00:06

I have an input field with number type


In normal browsers, I\'m typing some numbers and I\'m

7条回答
  •  生来不讨喜
    2021-02-07 00:35

    In an ionic application I used a directive on the body that intercepts the inputs.

    MyApp.directive('dismissIosKeyboardOnClick', function () {
            return function (scope, element, attrs) {
              if (cordova.platformId=="ios") {
                element.on("touchstart", function(e) {
                  var keyboardDoms = new Set(["INPUT","TEXTAREA","SELECT"]);
                  if( keyboardDoms.has(document.activeElement.nodeName) &&
                      !keyboardDoms.has(e.target.nodeName) )
                    document.activeElement.blur();
                  });
                }
            };
          });
    

    Index.html

    
    

提交回复
热议问题