this is how i'm trying
<script type="text/javascript"> $(document).ready(function(){ $('#dateIn,#dateOut').click(function(e){ e.preventDefault(); }); }); </script>
but the input stills 'launching' iphone's keyboard
ps: i want to do this because i'm using datepicker plugin for date
Adding a padding to the bottom of the page that is large enough for the keyboard enables content to be displayed as desired when the keyboard is visible.
To block the mobile device keyboard from displaying you simply need to set the field to readonly with jQuery as displayed in the code below. $('#input_92_31'). attr('readonly','readonly'); Hope this helps!
By adding the attribute readonly
(or readonly="readonly"
) to the input field you should prevent anyone typing anything in it, but still be able to launch a click event on it.
This is also usefull in non-mobile devices as you use a date/time picker
<input inputmode='none'>
The
inputmode
global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents. It can have the following values:
none
- No virtual keyboard. For when the page implements its own keyboard input control.
I am using this successfully (Tested on Chrome/Android)
CSS-Tricks: Everything You Ever Wanted to Know About inputmode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With