How to set default date in text box? Jquery

jquery, jquery-ui

Solution

$("#departing_on").val($.datepicker.formatDate("dd-mm-yy", new Date()));
$("#return_on").val($.datepicker.formatDate("dd-mm-yy", new Date()));

Add the above code at the end of the script. This is required because the datepicker plugin has no provision to set the date in the control while initializing.

Problem

i am using jquery 1.10 view Template ``` <script> $(function() { $( "#departing_on" ).datepicker({ dateFormat: "dd-mm-yy", numberOfMonths:[1,2], minDate: new Date() }); $( "#return_on" ).datepicker({ dateFormat: "dd-mm-yy", numberOfMonths:[1,2], minDate: new Date() }); }); </script> ``` First time while selecting I want default today's date in text box. how ?

Original source