简体   繁体   中英

Trigger select event of jquery datepicker on page load

I have html as :

<input type="text" class="form-control" id="activityDate" name="activityDate" value="
{{getDateEditAct date}}" ">
<input type="text" class="form-control" id="deadlineForConfirmation" 
name="deadlineForConfirmation" >

and I want to trigger select event of jquery datepicker of activityDate on page load so the this fucntion will be called :

  $('#activityDate').datepicker({
            maxDate: tripdep,
            minDate: minimumDate,
            onSelect: function(selectedDate) {
              $('#deadlineForConfirmation').datepicker('option', 'maxDate', selectedDate       || tripdep);
            }
     });

and the maxDate of deadlineForConfirmation will be set automatically.

I am trying to trigger this by :-

$('#activityDate').select();

or

$('#activityDate').change();

But its not working. Can anyone help me?

Use as follows . Specify the date you want

  $('#activityDate').datepicker( "setDate", "10/12/2012" );

JSFIDDLE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM