There is an option with the jQuery UI datepicker to only open the datepicker when a button image is clicked. See the following for an example:
http://jqueryui.com/demos/datepicker/#icon-trigger
The problem is that the focus is in the textfield as soon as the datepicker opens. Is it possible to disable the setting of the focus?
When using a page like the above on a mobile device like an iPhone, the keyboard pops up because the textfield gains the focus. This is not really userfriendly since you have to close the keyboard to actually get to the datepicker and use it...
Datepicker has a built-in disable method for this you can use, which also disables the text input, like this: $("#datepicker"). datepicker("disable");
You can restrict the users from selecting a date within the particular range by specifying MinDate and MaxDate properties. The default value of MinDate property is 1/1/1920 and MaxDate property is 12/31/2120 .
$(document). mouseup(function (e) { $('#example1'). Close(); });
set input to ReadOnly
<input type="text" id="datePicker" readonly>
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