Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide keyboard in iphone safari webapp

I'm creating a webapp for the iPhone, based in HTML/CSS/JS. I'm using forms to receive input and pass data to the script, but a problem I'm encountering is that the keyboard won't disappear. The user will enter the information, hit submit, and since it's JavaScript the page doesn't reload. The keyboard remains in place, which is a nuisance and adds another step for users (having to close it).

Is there any way to force the keyboard in Safari to go away? Essentially, I have a feeling this question is equivalent to asking how I can force an input box to lose focus or to blur. Looking online, I find plenty of examples to detect the blur event, but none to force this event to occur.

like image 418
munchybunch Avatar asked May 23 '10 00:05

munchybunch


People also ask

How do I hide the onscreen keyboard on my iPhone?

To hide it, slide your finger down from above the text-entry box and the keyboard will start to disappear. Carry on until only the text-entry box is left.

How do I hide the keyboard app?

You can force Android to hide the virtual keyboard using the InputMethodManager, calling hideSoftInputFromWindow , passing in the token of the window containing your focused view. This will force the keyboard to be hidden in all situations. In some cases, you will want to pass in InputMethodManager.

How do you hide your keyboard?

Tap the back button on your Android. It's the left-pointing arrow button at the bottom of the screen, either at the bottom-left or bottom-right corner. The keyboard is now hidden.


1 Answers

Even more simply, you can call blur() on the currently focused element. $("#inputWithFocus").blur()

like image 152
Steven Avatar answered Sep 23 '22 08:09

Steven