<legend id='8jdnI'><style id='8jdnI'><dir id='8jdnI'><q id='8jdnI'></q></dir></style></legend>
    • <bdo id='8jdnI'></bdo><ul id='8jdnI'></ul>

    1. <i id='8jdnI'><tr id='8jdnI'><dt id='8jdnI'><q id='8jdnI'><span id='8jdnI'><b id='8jdnI'><form id='8jdnI'><ins id='8jdnI'></ins><ul id='8jdnI'></ul><sub id='8jdnI'></sub></form><legend id='8jdnI'></legend><bdo id='8jdnI'><pre id='8jdnI'><center id='8jdnI'></center></pre></bdo></b><th id='8jdnI'></th></span></q></dt></tr></i><div id='8jdnI'><tfoot id='8jdnI'></tfoot><dl id='8jdnI'><fieldset id='8jdnI'></fieldset></dl></div>

      <small id='8jdnI'></small><noframes id='8jdnI'>

        <tfoot id='8jdnI'></tfoot>
      1. 如何捕获触摸设备的屏幕键盘“keydown"和“

        时间:2023-09-07
        1. <tfoot id='rEfLx'></tfoot>
        2. <legend id='rEfLx'><style id='rEfLx'><dir id='rEfLx'><q id='rEfLx'></q></dir></style></legend>

          <small id='rEfLx'></small><noframes id='rEfLx'>

            <tbody id='rEfLx'></tbody>

            <i id='rEfLx'><tr id='rEfLx'><dt id='rEfLx'><q id='rEfLx'><span id='rEfLx'><b id='rEfLx'><form id='rEfLx'><ins id='rEfLx'></ins><ul id='rEfLx'></ul><sub id='rEfLx'></sub></form><legend id='rEfLx'></legend><bdo id='rEfLx'><pre id='rEfLx'><center id='rEfLx'></center></pre></bdo></b><th id='rEfLx'></th></span></q></dt></tr></i><div id='rEfLx'><tfoot id='rEfLx'></tfoot><dl id='rEfLx'><fieldset id='rEfLx'></fieldset></dl></div>
              <bdo id='rEfLx'></bdo><ul id='rEfLx'></ul>

                  本文介绍了如何捕获触摸设备的屏幕键盘“keydown"和“keyup"事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我已经定义了在桌面上运行良好的键盘事件,但对于没有获得屏幕键盘事件的触摸设备.如果用户正在输入,我需要捕获.我使用了以下代码段:

                  I have defined keyboard events which is working good in desktop but for touch devices not getting the onscreen keyboard event. I need to capture if user is typing. I have used the following segment of code :

                  $('#id').keydown(function(e){
                    //some code here
                  });
                  
                  $('#id').keyup(function(e){
                    //some code here
                  })
                  

                  我希望 keydownkeyup 中定义的代码即使对于触摸设备(平板电脑和手机)也能触发.请建议如何捕获屏幕键盘事件并使上述代码运行.

                  I want the code defined in keydown and keyup to trigger even for touch devices (both tablets and mobiles). Please suggest how to capture the onscreen keyboard event and make the above code to run.

                  推荐答案

                  你试过用按键代替按键吗

                  Have you tried using key press instead of key down

                  $("#id").keypress(function() {
                  
                  });
                  

                  更新:

                  由于 android 的问题,我现在通常像这样包装我的支票

                  Due to android problems I now normally wrap my checks like this

                  if ($.browser.mozilla) {
                      $("#id").keypress (keyPress);
                  } else {
                      $("#id").keydown (keyPress);
                  }
                  
                  function keyPress(e){
                      doSomething;
                  }
                  

                  这篇关于如何捕获触摸设备的屏幕键盘“keydown"和“keyup"事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在按键上检测 Alt Gr(Alt Graph)修饰符 下一篇:调度键盘事件在 JavaScript 中不起作用

                  相关文章

                  最新文章

                  <i id='j5Bj0'><tr id='j5Bj0'><dt id='j5Bj0'><q id='j5Bj0'><span id='j5Bj0'><b id='j5Bj0'><form id='j5Bj0'><ins id='j5Bj0'></ins><ul id='j5Bj0'></ul><sub id='j5Bj0'></sub></form><legend id='j5Bj0'></legend><bdo id='j5Bj0'><pre id='j5Bj0'><center id='j5Bj0'></center></pre></bdo></b><th id='j5Bj0'></th></span></q></dt></tr></i><div id='j5Bj0'><tfoot id='j5Bj0'></tfoot><dl id='j5Bj0'><fieldset id='j5Bj0'></fieldset></dl></div>
                    1. <legend id='j5Bj0'><style id='j5Bj0'><dir id='j5Bj0'><q id='j5Bj0'></q></dir></style></legend>
                        <bdo id='j5Bj0'></bdo><ul id='j5Bj0'></ul>
                      <tfoot id='j5Bj0'></tfoot>
                    2. <small id='j5Bj0'></small><noframes id='j5Bj0'>