Manual disable datepicker Entry In javascript

By 19th March 2019JQuery

While you are working on javascript datepicker, and if you restricts the date range then user should also restrict to do manual input of date.

you can’t put readonly or disabled attribute on date input textbox.

you can put attr() and readonly attribute at the datepicker method.

Ex:

$('.datepickr').datepicker({
                'format': 'mm-dd-yyyy',
                'autoclose': true,
                'forceParse': false,
                'startDate': '03-19-2019',
                'endDate': '03-25-2019'
            }).attr('readonly', 'readonly');

this is the way to add readonly attribute when you are using datepicker on a textbox.

Leave a Reply