2011-01-02 4 views
3

jQueryを使用してRETURNキーをTABに置き換えるWebアプリケーションがあるので、ユーザーが押してもフォームが送信されずにカーソルが次のテキストフィールド。選択、フォーカス、または常に(jQuery)でiPadキーボードを表示

これはすべてのブラウザで機能しますが、iPadでは1/2しか動作しません。 iPadでは、次のフィールドは強調表示されますが、キーボードは隠されています。どのようにキーボードを見えるようにしたり、何らかの形で強制することができますか?私はそれがテキスト入力要素に触れるとclickmouseupまたはmousedownをトリガするユーザーせずにキーボードを表示することはできません信じて

function checkForEnter (event) { 
    if (event.keyCode == 13) { 
      currentBoxNumber = textboxes.index(this); 
     if (textboxes[currentBoxNumber + 1] != null) { 
      nextBox = textboxes[currentBoxNumber + 1] 
      nextBox.focus(); 
      nextBox.select(); 
      event.preventDefault(); 
      return false; 
     } 
    } 
} 

Drupal.behaviors.formFields = function(context) { 
    $('input[type="text"]').focus(function() { $(this).removeClass("idleField").addClass("focusField"); }); 
    $('input[type="text"]').blur(function() { $(this).removeClass("focusField").addClass("idleField"); }); 

    // replaces the enter/return key function with tab 
    textboxes = $("input.form-text"); 
    if ($.browser.mozilla) { 
     $(textboxes).keypress (checkForEnter); 
    } else { 
     $(textboxes).keydown (checkForEnter); 
    } 
}; 

答えて

2

は、ここに私のコード(http://thinksimply.com/blog/jquery-enter-tabに感謝)です。

これはby designように表示されます。

設計することにより、モバイルSafariでいくつかのフォーカス()イベントは無視されます。多くのサイトが不必要にfocus()を行い、キーボードを起動するのが遅く/侵入します。