views:

18

answers:

2

When the user selects today in the datepicker, I want the associated input box to show the word "Today".

Is there any reasonable way to accomplish this?

A: 

Are you looking the showButtonPanel: true option?

meder
A: 

You could attach a .change() handler to the input that checks the selected date when the value is changed, and updates the value with "Today" if necessary.

Try it out: http://jsfiddle.net/gn4Fj/

$('input').datepicker()
    .change(function() {
        var today = new Date().getDate();
        var val = new Date(this.value).getDate();
        if(today === val)
            this.value = "Today";
});
patrick dw
Sounds like I can't really do what I want without some extra work. What I'd really like is for the text box to read things like, "Today", "Yesterday", "Last Wednesday", "Next Tuesday", etc....Your solution seems like a good one.
ablerman