What is the Mobile Safari event to close the on-screen keyboard?

I want to run $('html, body').animate({ scrollTop: 0 }, 0); anytime the on-screen keyboard is closed in my iPad web application. I tried using .blur(); , but this causes problems if the user focuses on the next or previous field directly from the on-screen keyboard.

Does the keyboard close an event? That would be the most stable way for me.

+4
source share
2 answers

Switch the event to blur (), and it seems to work much better with the iPad, there are still weird things on the Playbook. I do not think you have an incendiary game.

 // Check for dirty inputs $("form :input").blur(function() { // FORCE THE PAGE BACK TO THE TOP $('html, body').animate({ scrollTop: 0 }, 0); }); 
+2
source

I tried to check for dirty inputs, and it seems that the selector works after closing the keyboard, so I put your code there and it worked like a charm:

 // Check for dirty inputs $("form :input").change(function() { // DO OTHER HOUSE KEEPING HERE // FORCE THE PAGE BACK TO THE TOP $('html, body').animate({ scrollTop: 0 }, 0); }); 

It works on ipad without any quirks. On the Playbook, it looks like the user should select the β€œreturn” button and then close the keyboard for the change function to work correctly.

+2
source

All Articles