<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>

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

        时间:2023-06-21
            <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();
                                  }
                          }
                      });
                  

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

                  上一篇:如何在固定模态错误中修复 iOS 11 输入元素 下一篇:如何将参数从链接元素传递到模式窗口?

                  相关文章

                • <small id='PHdIT'></small><noframes id='PHdIT'>

                    • <bdo id='PHdIT'></bdo><ul id='PHdIT'></ul>
                  1. <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>

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