views:

1233

answers:

4

Hello. I'm using jQueryUI Datepicker and show "Today" button. But it doesn't work. It also doesn't work in demo: http://www.jqueryui.com/demos/datepicker/#buttonbar

I'w want to fill input with today when press this button.

Is it possible to get it works?

A: 

Documentation says what "today" button which title could be altered via

.datepicker('option', 'currentText', 'New Title')

only changes displayed month to current. This behaviour also could be configured

.datepicker('option', 'gotoCurrent', true);

After that pressing the button will change displayed month to selected date's one.

It seems submitting a date with this button is impossible by design.

Alexander Prokofyev
+3  A: 

Their code is not really broken. It just doesn't do what most people would expect it to do. Which is to enter today's date into the input box. What it does do, is highlight for the user to see today's date on the calendar. If they were off in another month or another year, the calendar pops back to today's view without deselecting the date the user already selected.

To make it more intuitive, you'll need to update the plugin code to suit your needs. Let me know how it goes.

You'll need to get the uncompressed version of the jquery-ui javascript. I'm looking at version 1.7.2 and the "_gotoToday" function is on line 6760. Just add a call into that _gotoToday that fires off the _selectDate() function on line 6831. :) Happy Coding.

A: 

I just got rid of it.

In some css file that's part of your page:

.ui-datepicker-current { visibility:hidden }

BillB
+1  A: 
meesterjeeves