title: All Jquery UI DatePicker and KnockoutJS Change event on one fires for all
body: <p>I am using the solution found here:</p>
  
  <p><a href="https://stackoverflow.com/questions/6612705/knockout-with-jquery-ui-datepicker">jQuery UI datepicker change event not caught by KnockoutJS</a></p>
  
  <p>I have a number of datepicker controls on the page.  When one changes, the change event fires for all of them.  </p>
  
  <p>RefreshData is a custom function that refreshes data in the ViewModel when the date range is changed.</p>
  
  <p>What am I missing - its been a very frustrating afternoon trying to get this working properly</p>
  
  <p>Here is my knockout binding:</p>
  
  <pre><code>ko.bindingHandlers.datepicker = {
  init: function (element, valueAccessor, allBindingsAccessor) {
      var options = allBindingsAccessor().datepickerOptions || {};
      $(element).datepicker(options);
  
      ko.utils.registerEventHandler(element, "change", function () {
          var observable = valueAccessor();
          observable($(element).datepicker("getDate"));
      });
  
      ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
          $(element).datepicker("destroy");
      });
  
  },
  update: function (element, valueAccessor) {
      var value = ko.utils.unwrapObservable(valueAccessor());
      var current = $(element).datepicker("getDate");
  
      if (value - current !== 0) {
          $(element).datepicker("setDate", value);
      }
  
      RefreshData(element.id); //Should only fire once, but is firing for every datepicker on the page
  }
  };
  </code></pre>