Skip to content
Advertisement

Change jquery ui datepicker programmatically

I’ve got a jquery ui datepicker on my page. It’s linked to a span not an input. It’s currently tweeked to select a week at a time. I’ve also got two buttons on my page ‘Previous Week’ and ‘Next Week’. I want the buttons to control what’s selected by the datepicker. (ie jump forward / backward by one week when pressed).

I’m not sure how to grab the datepicker so I can mess with it (or what I actually mess with – is there a real ‘object’ there, or is it a just a load of css / html component like ‘ui-datepicker-current-day’ etc).

Advertisement

Answer

there is a real object you can hold a reference to.

example:

var datePicker = $("#id").datepicker({firstDay: 1});

to know what you can do with it, check:

http://jqueryui.com/demos/datepicker/

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement