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
Also set the field to disabled when you disable the datePicker e.g
$("input").prop('disabled', true);
To stop the image being clickable you could unbind the click event on that
$('img#<id or class ref>').unbind('click');
Try something like this it will help you
$("#from").click(function () {
$('#from').attr('readonly', true);
});
Thanks
simply use the following code
$("#from").datepicker({
showOn: "off"
});
it will not show the display of datepicker
This works for me on toggling enable and disable datepicker of JQuery:
if (condition) {
$('#ElementID').datepicker(); //Enable datepicker
} else {
//Disable datepicker without the ability to enter any character on text input
$('#ElementID').datepicker('destroy');
$('#ElementID').attr('readonly', true); }
I don't know why but when I use enable/disable in datepicker options, it doesn't behave the way it should be. It only works after you enable and disable it, but once you disable it, it doesn't enable again after, so the code above works perfectly fine for me:
if (condition) {
$('#ElementID').datepicker('enable'); //Enable datepicker
} else {
//Disable datepicker but I cannot enable it again once it goes through this condition
$('#ElementID').datepicker('disable'); }
try
$("#from").datepicker().datepicker('disable');
$("#nicIssuedDate").prop('disabled', true);
This is works 100% with bootstrap Datepicker