Reputation: 143
I'm attempting to hide the iPad soft keyboard when the user clicks outside a text field.
Specifically somewhere on the form or body that contains no other elements.
Using jquery, jquery mobile, and html5.
Upvotes: 10
Views: 8919
Reputation: 2077
using mattwindwer's solution (but with more details):
$(document).click(function() {
document.activeElement.blur();
});
Upvotes: 3
Reputation: 1800
Calling focus()
method on a button (even hidden buttons) hides the keyboard. I have used this in my ipad web app.
You can add a click listener to body and using target property of the event, you can determine when to hide the keyboard.
Upvotes: 1