title: JQuery Datapicker multiple selection and highlight dates
body: <p>I'm trying to use the Datapicker as a Calendar and want to highlight special dates but also want to use the multiple date selection.
  Multiple Selection is working and highligt dates is working too.
  But if I try to use both in the same Calendar it wont work.
  I hope you can understand me cause english is not my native language.</p>
  <pre><code>jQuery(&quot;#kalender-container&quot;).datepicker
  ({
      showButtonPanel: false,
      selectMultiple:true,
      firstDay: 1, 
      showWeek: true,
      beforeShowDay: function (date) 
          {
              var theday = (date.getMonth()+1) +'/'+ 
              date.getDate()+ '/' + 
              date.getFullYear();
              return [true,$.inArray(theday, datesArray) &gt;=0?&quot;specialDate&quot;:($.inArray(theday, datesArray1)&gt;=0?&quot;specialDate1&quot;:'')];
          }
  });
  </code></pre>
  <p>I hope soneone can help me with my problem.</p>
  <p>Thank you very much in advance for your answer.</p>
  <h1>edit code for selectMultiple</h1>
  <pre><code>&lt;script&gt;
  var dates = new Array();
  function addDate(date) {if (jQuery.inArray(date, dates) &lt; 0) dates.push(date);}
  function removeDate(index) {dates.splice(index, 1);}
  
  // Adds a date if we don't have it yet, else remove it
  function addOrRemoveDate(date)
  {
    var index = jQuery.inArray(date, dates); 
    if (index &gt;= 0)
      removeDate(index);
    else 
      addDate(date);
  }
  
  // Takes a 1-digit number and inserts a zero before it
  function padNumber(number)
  {
    var ret = new String(number);
    if (ret.length == 1)
      ret = &quot;0&quot; + ret;
    return ret;
  }
  
  jQuery(function() {
        $.datepicker.regional['de'] = {
                  monthNames: ['Januar','Februar','März','April','Mai','Juni',
                  'Juli','August','September','Oktober','November','Dezember'],
                  monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
                  'Jul','Aug','Sep','Okt','Nov','Dez'],
                  weekHeader: 'Wo', weekStatus: 'Woche des Monats',
                  dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
                  dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
                  dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
                   firstDay: 1,showWeek:true};
          $.datepicker.setDefaults($.datepicker.regional['de']);
  jQuery(&quot;#kalender-container&quot;).datepicker({onSelect: function(dateText, inst) { addOrRemoveDate(dateText); },
                                beforeShowDay: function (date){
                                  var year = date.getFullYear();
                                  // months and days are inserted into the array in the form, e.g &quot;01/01/2009&quot;, but here the format is &quot;1/1/2009&quot;
                                  var month = padNumber(date.getMonth() + 1);
                                  var day = padNumber(date.getDate());
                                  // This depends on the datepicker's date format
                                  var dateString = month + &quot;/&quot; + day + &quot;/&quot; + year;
  
                                  var gotDate = jQuery.inArray(dateString, dates);
                                  if (gotDate &gt;= 0) {
                                    // Enable date so it can be deselected. Set style to be highlighted
                                    return [true,&quot;ui-state-highlight&quot;]; 
                                  }
                                  // Dates not in the array are left enabled, but with no extra style
                                  return [true, &quot;&quot;];
                                }
                          });
  });
  
  &lt;/script&gt;
  </code></pre>