Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Mobile Force hide soft keypad on focusing text input field

I have a date field on a PHP website and I'm using jQuery Mobile for mobile site.

While browsing the site on a mobile browser, (eg firefox mobile on android), on clicking on the date text input, the calendar dialog comes up, but the soft keyboard also comes up on my android (Soft keypad comes up whenever one focuses on a input field) Is there a way, I can force hide the soft keyboard ? Is there a generic javascript based trick to force hide the soft keypad (that works on all mobile devices like iphone, android etc ?

I'm using the jQuery Mobile datepicker from here TIA

like image 696
texens Avatar asked Nov 01 '11 19:11

texens


2 Answers

A more simple solution is to add readonly="true" to the input boxes that you have the datepicker attached to. Even though you can't manually type in a date, on mobile you won't have to deal with the keyboard popping up and getting in the way

like image 72
mdurchholz Avatar answered Sep 28 '22 06:09

mdurchholz


Just found an answer to my question. (Guess I didn't search with the right keywords earlier :-|)

Adding a jQuery blur event on focus solves the issue.

Thanks to this post by Danny C

like image 38
texens Avatar answered Sep 28 '22 06:09

texens