mui into the page input box automatically pops up keyboard focus

This content community has, with a collection of a relatively wide, and record it when I use this pit

mui.plusReady(function() {
   setTimeout(function(){
      initNativeObjects();
      showSoftInput();
 },50)

})

 

 

var initNativeObjects = function() {
if (mui.os.android) {
console.log(1)
var main = plus.android.runtimeMainActivity();
var Context = plus.android.importClass("android.content.Context");
InputMethodManager = plus.android.importClass("android.view.inputmethod.InputMethodManager");

= main.getSystemService IMM (Context.INPUT_METHOD_SERVICE);


the setTimeout (function () {
// write specific logic provided herein may be acquired focus INPUT
var inputElem = document.querySelector ( "INPUT")
inputElem.focus ();
inputElem.parentNode .classList.add ( 'MUI-Active');
}, 100);
} {the else
the console.log (2)
nativeWebview = plus.webview.currentWebview () nativeInstanceObject ();.
the setTimeout (function () {
// here DETAILED writable logical arrangement of the acquired focus INPUT
var inputElem = document.querySelector ( "INPUT")
inputElem.focus ();
inputElem.parentNode.classList.add ( 'MUI-Active');
}, 100);
}
};
var showSoftInput = function () {
var nativeWebview = plus.webview.currentWebview () nativeInstanceObject ( );. // When this code is used in order to prevent some of the variable elastic phone keypad is not up
IF (mui.os.android) {
the console.log (. 3)
plus.android .importClass (nativeWebview);
nativeWebview.requestFocus ();
imm.toggleSoftInput (0, InputMethodManager.SHOW_FORCED);
} {the else
the console.log (. 4)
nativeWebview.plusCallMethod ({
"setKeyboardDisplayRequiresUserAction": to false
});

document.querySelector ( ' . INPUT ') focus ();
}
the setTimeout (function () {
// write specific logic provided herein may be acquired focus INPUT
var inputElem = document.querySelector ( "INPUT")
inputElem.focus ();
inputElem.parentNode.classList .add ( 'MUI-Active');
}, 100);
};

 

This code is theoretically Andrews ios common

 

But, but this is my pit

The jump into the event page,

Mui must use the built-in click event, whether the thief to enter the page automatically pops up keyboard is not good to make the ios

I used to use

 document.getElementById('input1').addEventListener('tap', function() {

   

mui.openWindow({
})

}); this is not OK

Must be used

mui(document).on("tap","#input1",function(){
mui.openWindow({

})
})

friendly reminder,

Update Now more and more nausea,

If it is determined to develop the use of mui, mui remember everything best to use good package, or project a problem you do not know what the reason

For example, the latest HbuliderX jq in the $ .ajax be cross-domain request, the request must be made to use mui.ajax, or else not being given, the program is not executed, in that the card,

 

Guess you like

Origin www.cnblogs.com/lishuang2243/p/11776147.html