Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding in the iOS keyboard when user clicks outside of a text box

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.

like image 657
yeowoh Avatar asked Mar 08 '12 15:03

yeowoh


2 Answers

document.activeElement.blur();
like image 79
mattwindwer Avatar answered Oct 14 '22 07:10

mattwindwer


using mattwindwer's solution (but with more details):

$(document).click(function() {
    document.activeElement.blur();
});
like image 26
clintgh Avatar answered Oct 14 '22 06:10

clintgh