title: Update DaysOfWeekDisabled of bootstrap datepicker on changing value in a select dropdown
body: <p>I am trying to change datepicker option based on the input of a dropdown. 
  There are three cases. For case1 and case2 I want only Monday, Wednesday and Thursday to be available for selection and all other days will be blurred/disabled. </p>
  
  <p>For case3 Monday, Tuesday, Wednesday and Thursday will be enabled and all other days will be blurred or disabled. </p>
  
  <p>The problem is the datepicker works according to the firsttime selection. For example, if I select case1 first, the calendar option works fine. After that if I select case 3 it does not change the calendar options. That means it shows only the date disabled which were for case 1. It should have enabled Tuesday in the calendar but it did not. </p>
  
  <pre><code>    &lt;select name="iEventType" id="iEventType" class="form-control select2"&gt;
       &lt;option value=""&gt;Select Event Type&lt;/option&gt;
        &lt;option value="case1"&gt;case1&lt;/option&gt;
        &lt;option value="case2"&gt;case2&lt;/option&gt;
        &lt;option value="case3"&gt;case3&lt;/option&gt;
  
    &lt;/select&gt;
  
      &lt;div class="input-field" id="event_type"&gt;                          
        &lt;input type="text" class="form-control"  placeholder="Select Day (Please Select Event Type First)"  name="event_days" id="iEventDays" value=""&gt;
      &lt;/div&gt;
  
  
  
  &lt;script&gt;
       $("#iEventType").change(function() {
         var val = $(this).val();
         if (val == "case1" || val == "case2") {
           var disabled_day = [0, 2, 5, 6];
  
           $('#iEventDays').datepicker({
             startDate: new Date(),
             autoclose: true,
             format: 'mm/dd/yyyy',
             daysOfWeekDisabled: disabled_day
           });
  
         } else if (val == "case3") {
  
  
           var disabled_day = [0, 5, 6]
           $('#iEventDays').datepicker({
             startDate: new Date(),
             autoclose: true,
             format: 'mm/dd/yyyy',
             daysOfWeekDisabled: disabled_day
           });
  
         } else {
           $("#iEventDays").val("");
         }
       });
  &lt;/script&gt;
  </code></pre>
  
  <p>You can see the <a href="https://jsfiddle.net/hriju/0cvj4g1m/12/" rel="nofollow noreferrer">JS Fiddle</a> in here.</p>
  
  <p>Pleases let me know how I can solve this problem. I have tried with datepicker destroy and again reinitiating the calendar in my code, for that case also it did not work. </p>
  
  <p>I have already searched similar issues and answer like the following. </p>
  
  <p><a href="https://stackoverflow.com/questions/34126840/datepicker-in-jquery-is-not-loaded-for-the-second-time">DatePicker in jquery is not loaded for the second time</a></p>