我使用引导程序daterangepicker.js库,在“date”类的文本字段中生成日历。我有两个文本字段,它完美的工作模式之外,但在模式中的类“date1”和“date2”的文本字段不起作用。Datepicker不能在模态中工作。 Angular.js
我需要一个很好的解决方案来验证两个日期,我想验证哪个日期是主要的。
为什么会发生这种情况,我该怎么办?
$('.date').daterangepicker({
"singleDatePicker": true,
"opens": "right",
})
$('.date1').daterangepicker({
"singleDatePicker": true,
"opens": "right",
})
$('.date').daterangepicker({
"singleDatePicker": true,
"opens": "right",
})
<div ng-app="myApp">
<input type='text' class='date'>
<script type="text/ng-template" id="myModal.html">
<div class="modal-header">
<h3 class="modal-title">Modal title</h3>
</div>
<div class="modal-body">
date1
<input type='text' class='date1' id='date1'>
date2
<input type='text' class='date2' id='date1'>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="close(true)">OK</button>
<button class="btn btn-warning" ng-click="close('modalInstanceOne')">Cancel</button>
</div>
<div ng-controller="MyCtrl">
<input type="button" value="Show modal" ng-click="showModal()" />
</div>
http://fiddle.jshell.net/q24rmsbn/
你为什么用角混合不必要的jQuery? –
可能与您的问题无关,但请尽量避免对多个元素使用相同的ID。您将id用作date1作为input.date1和input.date2。 – rJ7
rJ7谢谢!解决 – yavg