Search code examples
jqueryipadmobile-safari

What is the Mobile Safari event for the on-screen keyboard closing?


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

Does closing the keyboard trigger an event of any sort? That would be the most stable route for me to go.


Solution

  • Switched the event to blur() and it seems to work a lot better with the iPad, Playbook still does some strange things. I don't think the event firing is quite there for the Playbook yet.

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