Android chrome: avoid keyboard to hide when icon is pressed

william :

Chrome's default behavious is to hide the keyboard, when this one is open/shown and I click in any part of the screen. I want to achieve to prevent it from hidding if I click in a specific DOM element. Is that possible using JS?

window.onclick = function(event) {
  var sendMsgBtn = document.getElementById("send-msg-icon");
  if (event.target == sendMsgBtn) {
    //what to do here
  }
}
vik24 :

If you focus on a <input> or <textarea> element (it may be hidden) and then you click on it, the keyboard will not hide

window.onclick = function(event) {
   var sendMsgBtn = document.getElementById("send-msg-icon");
      if (event.target == sendMsgBtn) {
        var input1 = document.getElementById("input1");
        input1.focus();
        input1.click();
      }
  }

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=375993&siteId=1