1

I have this page with a booking widget and date picker here:

http://anivillas.com/

(Book your stay)

The following code is set to try and prevent the keyboard from coming up on mobile devices when choosing the datepicker.

<script type="text/javascript">
jQuery(function() {
 jQuery( ".hasDatepicker" ).hasDatepicker({ 
 }).attr('readonly','readonly');
});
</script>

This is working on desktop but not mobile devices. Does someone know how to prevent the keyboard from popping up on mobile?

junger
  • 65
  • 1
  • 9

3 Answers3

0

Try this (taken from ipad web application: How do I prevent the keyboard from popping up on jquery datepicker):

$(".datePicker").datepicker({
    showOn: 'button',
    onClose: function(dateText, inst) 
    { 
        $(this).attr("disabled", false);
    },
    beforeShow: function(input, inst) 
    {
        $(this).attr("disabled", true);
    }
});
Adam
  • 1,054
  • 1
  • 12
  • 26
0

For others looking for this answer, this is answered here: prevent iphone default keyboard when focusing an <input>

Either of these worked for me - edit the HTML tag as follows, rather than adding JS or jQuery:

<input ... readonly="readonly">
<input ... inputmode='none'>
LaZza
  • 360
  • 3
  • 7
0

Simply add the 'readonly' attribute to the form filed:

<input id="datepicker" type="text" name="name" required="" readonly>
TV-C-1-5
  • 680
  • 2
  • 13
  • 19