Nic Hubbard
Nic Hubbard

Reputation: 42165

jQuery UI Datepicker go to date URL

Does anyone know if it is possible to use the jQuery UI Datepicker, and when clicking on a date, set the document.location to that date, appended to a preset URL?

So, if I clicked on one of the dates, it might direct me to:

http://www.mysite.com?date=2009-10-25

I need to just use this as a quick way to quickly navigate my website calendar.

Ideas?

Upvotes: 2

Views: 4028

Answers (3)

Pointy
Pointy

Reputation: 413856

Just give it an onSelect function to call.

Upvotes: 2

wadziu
wadziu

Reputation: 1

I assume you download datapicker from Jqueryui.com with examples so you can get choosen date from calendar with:

$('#datepicker').val()

so paste it in onclick() function or onchane() function

Upvotes: 0

wadziu
wadziu

Reputation: 1

I did small example, it works for me just change date format :)

$().ready(function(){  
    $('#datepicker').click(function(){
        window.location.replace("http://www.mysite.com/?date=" + $('#datepicker').val());
    });
});

Upvotes: 0

Related Questions