Jquery UI 日期选择器不工作,但一切正常

Jquery UI Datepicker not working while everything looks fine

如何使此代码段有效?

jQuery(function($) {
  jQuery("#date-from").datepicker();
});
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<input class="from hasDatepicker" id="date-from" type="text" />

在顶部添加此行:<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/> 并从 input 标签中删除 class hasDatepicker 这样您的 input 标签将是 <input class="from" id="date-from" type="text" />

$("#date-from").datepicker();
<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<input class="from" id="date-from" type="text" />