The phone endpoint clicks the keyboard to hide the keyboard and executes the event when it cannot get the part of the KeyCode value

Source: Internet
Author: User

Use a timer to monitor window.innerheight height changes to determine. Trigger keyboard Other places also have event response

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "><script type=" Text/javascript "src=" Http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2.min.js "></" Script><input type= "text" id= "TXT"/><div id= "DV" ></div><script> var timer, Windowinnerheight; function Eventcheck (e) {if (e) {//blur,focus event-triggered $ (' #dv '). html (' Android keyboard ' + (E.type = = ' Focus '? ' Eject ': ' hide ') + '--through ' + E.type + ' event '); if (E.type = = ' click ') {//If the Click event Launch timer monitors whether the button is clicked on the hidden keyboard button on the keyboard, there is no event available to click on the buttons, KeyDown also gets keycode value SetTimeout (func tion () {///because the keyboard popup is animated, to get the full pop-up window height, use the timer windowinnerheight = window.innerheight;//get the window that pops up the Android soft keyboard Mouth Height timer = setinterval (function () {Eventcheck ()}, 100); }, 500); } else Clearinterval (timer); } else {//timer execution, need to determine the window visual height, if the change indicates that the Android keyboard hidden if (Window.innerheight > Windowinnerheight) {clearinterval (timer); $ (' #dv '). html (' Android keyboard hidden--by clicking the keyboard hide button '); }}} $ (' #txt '). Click (Eventcheck). blur (Eventcheck);</script>

Hide the keyboard and perform events

when the phone endpoint hits the keyboard and cannot get the part of the KeyCode value

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.