1

I need to make it so that if someone clicks on a date on the Bootstrap datepicker plugin, it redirects them to a page like www.website.com/browse.php?date=DATECLICKED.

This is my current code I'm using:

<li class="dropdown">
  <a class="dropdown-toggle" id="dp" data-toggle="dropdown" data-date-format="mm-dd-yyyy">Custom Date <b class="caret"></b></a>
</li>

How would this be done?

4

1 回答 1

4

您可以使用 changeDate 回调来触发重定向。

$('#dp').datepicker()
  .on('changeDate', function(ev){
    window.location.href = 'www.website.com/browse.php?date=' + ev.date.valueOf();
  });
于 2013-09-16T19:04:04.067 回答