State Persistence in JQuery DatePicker widget

18 Apr 20171 minute to read

You can sustain the entire widget model of DatePicker even after form post or browser refresh by using enablePersistence property. So the entire model values such as

  • Selected date
  • Highlighted date
  • Start and depth level

are stored in local storage / cookies of browser before page refreshes and reinitialized with the restored model after refresh.

  • javascript
  • $(function () {
    
                // creates DatePicker from input
    
                $("#datePicker").ejDatePicker({
    
                    enablePersistence: true // persists the DatePicker model
    
                });
    
            });