Search code examples
jqueryipadjquery-ui-datepicker

ipad web application: How do I prevent the keyboard from popping up on jquery datepicker


I have a form with an date field with a jquery datepicker attached to it.

When I select the date field the datepicker pops up but then the iPad keyboard slides into view and obscures the datepicker.

How do I prevent the keyboard from popping up in this situation?


Solution

  • I used a slightly modified version of Rob Osborne's solution and it successfully prevented the keyboard from popping up on the iPad and iPhone.

    $(".datePicker").datepicker({
        showOn: 'button',
        onClose: function(dateText, inst) 
        { 
            $(this).attr("disabled", false);
        },
        beforeShow: function(input, inst) 
        {
            $(this).attr("disabled", true);
        }
    });