Sometimes, we want to force the soft keyboard to hide with JavaScript.
In this article, we’ll look at how to force the soft keyboard to hide with JavaScript.
How to force the soft keyboard to hide with JavaScript?
To force the soft keyboard to hide with JavaScript, we call blur when we focus on the input.
For instance, we write
<input type="text" id="phone-number" onfocus="blur();" />;
to call blur when we focus on the input by setting the onfocus attribute to blur().
Conclusion
To force the soft keyboard to hide with JavaScript, we call blur when we focus on the input.