title: jquery datepicker onselect simple function
body: <p>The jquery datepicker plugin works, but I'd like to have onSelect triggering a function which opens a page in a new tab.</p>
  
  <p>The jquery datepicker plugin works, but I'd like to have onSelect triggering a function which opens a page in a new tab.</p>
  
  <pre><code>$("#dp").datepicker({
  beforeShowDay: highlightDays,
  
  //works perfectly fine
  
  onSelect: function(dates) { window.open('/en/calendar/' + dates, '_self'); },
  });
  
  var dates = [new Date(2011, 4 - 1, 28), new Date(2011, 5 - 1, 10),];
  
  //does not work
  
  onSelect: function(links) { window.open('/en/trip/' + links, '_self'); },
  
  var links = [new Link('link1'), new Link('link2'),];
  </code></pre>
  
  <hr>
  
  <p>the js:</p>
  
  <pre><code>$( "#toggleDP" ).click(function() { $("#dp ").datepicker('show'); });
  
  $("#dp").datepicker({
  changeMonth: true,
  changeYear: true,
  showOn: 'button',
  showButtonPanel: true,
  buttonImageOnly: true,
  buttonImage: "0.gif",
  dateFormat: 'yy-mm-dd',
  beforeShowDay: highlightDays,
  onSelect: function(dates) { window.open('/en/calendar/' + dates, '_self'); },
  });
  
  
  var links =[new Link('test'), new Link('test1'), ];
  var dates = [new Date(2011, 4 - 1, 28), new Date(2011, 5 - 1, 10), ];
  var txt = ['test','test1',];
  
  function highlightDays(date) {
  for (var i = 0; i &lt; dates.length; i++) {
  if (dates[i]-date==0) {
  return [true, 'markedDay', txt[i],];
  }
  }
  return [false, ''];
  }
  </code></pre>
  
  <p>if i were to set onSelect to function(links) { window.open('/en/trips/' + links, '_self'); }, then for some unknown reasons, it opens an URL with the corresponding DATE not with the corresponding link.</p>