In my php-file, I want to use the jQuery Datepicker.
When my file loads, I create the Datepicker disabled.
Then, when a special field in my php-file (it is a
I have a single-page app in our company intranet where certain date fields need to be "blocked" under certain circumstances. Those date fields have a datepicker binding.
Making the fields read-only wasn't enough to block the fields, as datepicker still triggers when the field receives focus.
Disabling the field (or disabling datepicker) have side effects with serialize() or serializeArray().
One of the options was to unbind datepicker from those fields and making them "normal" fields. But one easiest solution is to make the field (or fields) read-only and to avoid datepicker from acting when receive focus.
$('#datefield').attr('readonly',true).datepicker("option", "showOn", "off");