JQuery UI Datepicker无法正常工作
问题描述:
我遇到了一个问题,我感觉好像我的所有设置都正确;但是,无论如何,JQuery UI Datepicker将不是显示出来。JQuery UI Datepicker无法正常工作
,我有以下设置在我的头(角项目,头总是加载无论路线):
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
除了这
<script type="text/javascript">
$(function() {
var nativeDateInputIsSupported = Modernizr.inputtypes.date;
if (!nativeDateInputIsSupported) {
$("input[type='date']").datepicker();
}
});
</script>
然而,当我在Firefox和点击下面,什么都不会发生
<tr ng-repeat="revenue in runway.revenues">
<!-- Other table elements go here -->
<td>
<input type="date" id="date" max="{{maxDate}}" class="form-control" ng-model="revenue.date" placeholder="YYYY-MM-DD" required/> </td>
<td>
它也不会在这里显示
<input type="date" class="form-control" ng-model="user.startofbusiness" name="startofbusiness" id="startofbusiness" required>
我已经检查了许多不同的StackOverflow线程,但即使当我遵循由他们提出的方法时,我也无法得到它的合作。
任何提示将不胜感激!
答
事实证明,这是正确实施,并且实际上正在工作。问题在于使用ng-repeat动态生成表格的信息。我通过编写自定义指令来处理datepicker来解决这个问题。
你在控制台中看到什么? – Twisty
控制台中没有错误。嗯。为了进行调试,我试图向''input [type ='date']“'添加一个点击事件,理论上它发出了一个'console.log('是的,我们正在获取这个点击')',但是也不是射击。 –
你可以将你的代码移动到jsfiddle之类的东西吗? – Twisty