Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap datepicker disable feature

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.

like image 233
Juan Luis Avatar asked Sep 02 '13 09:09

Juan Luis


People also ask

How do I disable datepicker?

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.

What is Autoclose in datepicker?

autoclose. Whether or not to close the datepicker immediately when a date is selected.

Does bootstrap 4 have a datepicker?

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.

How do I use NgbDatepicker?

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.


1 Answers

You can do following:

For disabling:

$("#date").datepicker("option", "disabled", true);

and for enabling:

$("#date").datepicker("option", "disabled", false);

like image 170
Sadiksha Gautam Avatar answered Oct 07 '22 00:10

Sadiksha Gautam