Show iPad keyboard on select, focus or always (jQuery)
- by Ryan
I have a web app that is using jQuery to replace the RETURN key with TAB so that when I user presses return the form is not submitted but rather the cursor moves to the next text field.
This works in all browsers but only 1/2 works on the iPad. On the iPad the next field is highlighted but the keyboard is hidden. How can I keep the keyboard visible or force it somehow?
Here's my code (thanks to http://thinksimply.com/blog/jquery-enter-tab):
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);
}
};