I have a text box with an id of InactiveDate. It has a datepicker attached to it,
I tried the following but wasn't able to successfully populate the date: (Note I hardcoded for testing)
$('#InactiveDate').datepicker('09/09/2012');
Although my control is called InactiveDate, looks like below it make is hidden so not sure what to try.
When I run above code no date gets populated.
Here is what it looks like:
<div id="datePicker_InactiveDate">
<script language="javascript" type="text/javascript">
<input id="InactiveDate" class="data" type="hidden" value="" name="InactiveDate">
<input id="dp1342109969094" class="date hasDatepicker" type="text" onchange="javascript:updateData_InactiveDate()" value="">
</div>
<span class="field-validation-valid" data-valmsg-replace="true" data-valmsg-for="InactiveDate"></span>
</div>
That's not how .datepicker works. You need to use the setDate method.
$('#InactiveDate').datepicker('setDate', '09/09/2012');
Docs: http://jqueryui.com/demos/datepicker (Click the "methods" tab)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With