我有两个带有这样的datepicker的文本框。
<script type="text/javascript">
$(function () {
$('#value_date').datetimepicker({ format: 'MM/DD/YYYY' });
$('#run_date').datetimepicker({ format: 'MM/DD/YYYY hh:mm a' });
});
</script>
<div class='input-group date' id='value_date'>
<input type="text" id="txtValueDate" class="form-control" runat="server" placeholder="Value Date"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<div class='input-group date' id='run_date'>
<input type="text" id="txtRunDate" class="form-control" runat="server" placeholder="Run Date" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
然后,当value_date
的值发生变化时(例如03/31/2016),run_date
昨天自动设置为value_date
( 03/30/2016)作为默认的run_date,但仍可以通过datetimepicker进行更改。
我是怎么做到的?