Anup
Anup

Reputation: 3353

How to hide and show the keyboard on an iPhone using Phonegap and javascript

In my Phonegap application, I have one screen where if the user taps or clicks outside of the textarea, the keyboard should hide. I used the .blur( function, but by doing that the screen goes up and the user can't see the application bar on the top (the screen itself doesn't move though).

Upvotes: 1

Views: 4817

Answers (1)

Kevin Ennis
Kevin Ennis

Reputation: 14456

After calling blur, try window.scrollTo(0,0).

If I recall correctly, you might have to wrap it in a 0ms setTimeout

$('#someInput').blur();
setTimeout(function(){
  window.scrollTo(0, 0);
}, 0);

Upvotes: 2

Related Questions