Bob Bob - 1 year ago 299
Javascript Question

JQuery DatePicker ReadOnly

When I make my datepicker read-only, I see that the user cannot type anything into the text box.

$("#datepicker").attr('readonly', 'readonly');

However, they can still change the value using the calendar. How can I hide the calendar so that users cannot change the date value?

I do not want to disable the datepicker since I need the value posted to the server upon form submit.


Answer Source

You can set the range allowed to some invalid range so the user can't select any date:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download