jQuery Mobile selectmenu焦点和模糊事件不会触发

Ros*_*oss 5 jquery html5 jquery-mobile cordova

当表单元素被赋予焦点时,我试图隐藏页脚.我还想在表单元素失去焦点时显示页脚,模糊事件应该处理它.我无法在jQuery Mobile selectmenu表单元素上触发焦点或模糊事件.

这是我的一个表单元素的示例 -

<select id="radiology-study-provider" class="selectList"></select>
Run Code Online (Sandbox Code Playgroud)

这是jQuery代码,它应该隐藏我的页脚在焦点上并在模糊时显示它(它在DOM内部就绪) -

  $('.selectList').change(function(){
      console.log("the change event is firing");
  });
  $('.selectList').focus(function(){
      $('div:jqmData(role="footer")').hide(); // hide the footer
  });
  $('.selectList').blur(function(){
      $('div:jqmData(role="footer")').show(); // show the footer
  });
Run Code Online (Sandbox Code Playgroud)

奇怪的是,更改事件处理程序触发但焦点和模糊不会触发.

我在下面尝试了这个,它不会起作用 -

  $('.selectList').on('focus', function(){
      $('div:jqmData(role="footer")').hide(); // hide the footer
  });
  $('.selectList').on('blur', function(){
      $('div:jqmData(role="footer")').show(); // show the footer
  });
Run Code Online (Sandbox Code Playgroud)

我也试过这个 -

   $('.selectList').bind( "focus", function(event, ui) {
       $('div:jqmData(role="footer")').hide(); // hide the footer
  });
   $('.selectList').bind( "blur", function(event, ui) {
       $('div:jqmData(role="footer")').hide(); // hide the footer
  });
Run Code Online (Sandbox Code Playgroud)

我也尝试了focusin()和focusout()事件,也没有运气.我尝试了几十个选择器(div.ui-select就是其中之一).我不认为这是我正在使用的选择器的问题.

我正在使用jQuery Mobile 1.1.0和jQuery 1.7.1 - 我已经在http://jquerymobile.com/test/docs/forms/selects/events.html检查了jQuery Mobile selectmenu文档,与谷歌交谈,在这里搜索,并没有找到这个问题.

Ros*_*oss 4

这就是最终对我有用的东西。

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady () {
    document.addEventListener("hidekeyboard", onKeyboardHide, false);
    document.addEventListener("showkeyboard", onKeyboardShow, false);

}

function onKeyboardHide() {
    $('div:jqmData(role="footer")').show(); // show the footer
}

function onKeyboardShow() {
    $('div:jqmData(role="footer")').hide(); // hide the footer
}
Run Code Online (Sandbox Code Playgroud)

我在堆栈上遇到了这个 -显示隐藏键盘在 android PhoneGap 中无法正常工作,并注意到您可以监听这 2 个事件。