JQuery DatePicker: Get Selected Date

I need to remove the selected date from Datepicker and fill in another text box with the selected value. I am currently using the function onCloseas follows:

$('#defaultDate').datepicker({
    onClose:function(theDate) {
        $('#txtEntry1').text = theDate;
    }
});
+5
source share
2 answers

There is an easier way to do this. Use the built-in option

+12
source

Have you looked at the documents? http://docs.jquery.com/UI/Datepicker#events

on Select function (dateText, inst)

, . datepicker . .

onSelect init.

$('.selector').datepicker({
   onSelect: function(dateText, inst) { ... }
});
+6

All Articles