I am using knockout binding for jQuery date picker.
Refer to jQuery UI datepicker change event not caught by KnockoutJS
The same code is working fine except I can't set datepicker options dynamically.
How to set datepicker option (like mindate max date etc) dynamically (button click) using the the above reference link?
First, you need to make the
optionsobject part of your view-model. Then, upon changes, update thedatePickerwith the newoptions.This way, you can add any of the options (like
dayNamesanddateFormatetc) to youroptionsobject, and the binding handler will update the component automatically.For example (changing
minDatedynamically):And in the binding-handler (adding subscription to changes on
options):See Fiddle