Skip to content
Advertisement

How can I hide the Android keyboard using JavaScript?

I would like to hide the Android virtual keyboard in JavaScript. Someone suggested doing this:

JavaScript

But this doesn’t work if the keyboard is already visible. Is this something that can be done?

Advertisement

Answer

What you need to do is create a new input field, append it to the body, focus it and the hide it using display:none. You will need to enclose these inside some setTimeouts unfortunately to make this work.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement