I need in my project a feature I think bootstrap datepicker still doesn't offer. I'd like to enable/disable a datepicker field so a user can't be able to change its value. Something like a readOnly functionality.
Any ideas about it?
Thank you in advance.
To disable a datepicker in jQuery UI we will be using disable() method which is discussed below: jQuery UI disable() method is used to disable the datepicker. Parameters: This method does not accept any parameters.
autoclose. Whether or not to close the datepicker immediately when a date is selected.
Bootstrap date picker is a plugin that adds the function of selecting time without the necessity of using custom JavaScript code. This documentation may contain syntax introduced in the MDB 4.17. 0 and can be incompatible with previous versions. For old Date Picker documentation please follow the link.
Datepicker can be used either inline or inside of the popup. In the example above the template variable #d will point to the instance of the NgbDatepicker component in the first case. In the second it will point to the instance of the NgbInputDatepicker directive that handles the popup with inline datepicker component.
You can do following:
For disabling:
$("#date").datepicker("option", "disabled", true);
and for enabling:
$("#date").datepicker("option", "disabled", false);
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