<bdo id='Rg9vP'></bdo><ul id='Rg9vP'></ul>

    <legend id='Rg9vP'><style id='Rg9vP'><dir id='Rg9vP'><q id='Rg9vP'></q></dir></style></legend>

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

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

        检测模态对话框上的按键不起作用

        detect key press on modal dialog not working(检测模态对话框上的按键不起作用)
            <tbody id='QR4cU'></tbody>
          • <bdo id='QR4cU'></bdo><ul id='QR4cU'></ul>
            <legend id='QR4cU'><style id='QR4cU'><dir id='QR4cU'><q id='QR4cU'></q></dir></style></legend>

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

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

                • 本文介绍了检测模态对话框上的按键不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想在显示模式时检测用户是否按下了任何键.我尝试了以下代码,但未触发事件.

                  I would like to detect whether the user has pressed any key when a modal is shown. I tried the following code but the events are not fired.

                  代码片段:

                     $("#modal_confirmation_dp_change").on('keydown keyup input', function ( e ) {
                           alert();
                          });
                  

                  如果我尝试测试点击事件,它会被触发.

                  If I try to test click event, it is fired.

                     $("#modal_confirmation_dp_change").on('click', function ( e ) {
                              alert();
                          });
                  

                  我正在使用 twitter 引导模式.我错过了什么吗?

                  I am using twitter bootstrap modal. Am I missing something?

                  回答:我找到了解决我的问题的方法.看来我不应该指向模态的 id 以便检测到按键事件.

                  ANSWER: I found the solution to my problem. It seems like I should not point to the id of the modal so that the keypress event will be detected.

                  推荐答案

                  我找到了解决问题的方法.看来我不应该指向模态的 id 以便检测到按键事件.

                  I found the solution to my problem. It seems like I should not point to the id of the modal so that the keypress event will be detected.

                  $(document).on('keydown keyup input click',  function (e) {
                  if($('#modal_confirmation_dp_change').is(':visible')) {
                              var key = e.which;
                                  if (key == 13) { //This is an ENTER 
                                      $('#changed_dp_ok').click();
                                  }
                          }
                      });
                  

                  这篇关于检测模态对话框上的按键不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to make rooftext effect and valley text effect in HTML5 (or Fabric.js)(如何在 HTML5(或 Fabric.js)中制作屋顶文字效果和山谷文字效果)
                  Draw border around nontransparent part of image on canvas(在画布上的图像不透明部分周围绘制边框)
                  dragging and resizing an image on html5 canvas(在 html5 画布上拖动图像并调整其大小)
                  What#39;s the difference between a boolean as primitive and a boolean as property of an object?(作为原始对象的布尔值和作为对象属性的布尔值有什么区别?)
                  I want to do animation of an object along a particular path(我想沿特定路径对对象进行动画处理)
                  How to upload image into HTML5 canvas(如何将图像上传到 HTML5 画布中)
                  • <small id='PHdIT'></small><noframes id='PHdIT'>

                      • <bdo id='PHdIT'></bdo><ul id='PHdIT'></ul>

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

                            <tbody id='PHdIT'></tbody>
                          <tfoot id='PHdIT'></tfoot>
                          <legend id='PHdIT'><style id='PHdIT'><dir id='PHdIT'><q id='PHdIT'></q></dir></style></legend>