jQuery日期选择器javascript语法问题

时间:2018-10-22 13:27:03

标签: javascript html

the error试图做一些简单的事情,但是我遇到了一个错误,我是个初学者,所以我遇到了很多语法问题。 谢谢!

<input class="DateFrom" placeholder="min 7 days">

<script type="text/javascript"
  src="http://code.jquery.com/jquery-1.9.1.js"
  integrity="sha256-e9gNBsAcA0DBuRWbm0oZfbiCyhjLrI6bmqAl5o+ZjUA="
  crossorigin="anonymous"></script>
 <script type="text/javascript"
  src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"
  integrity="sha256-PsB+5ZEsBlDx9Fi/GXc1bZmC7wEQzZK4bM/VwNm1L6c="
  crossorigin="anonymous"></script>
  <script type="text/javascript">

      $("input.DateFrom").datepicker({
    minDate: 7,
    dateFormat: 'dd/mm/y',//check change
    changeMonth: true,
    changeYear: true
});

</script>
</body>

1 个答案:

答案 0 :(得分:0)

尝试一下

<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "input.DateFrom" ).datepicker( {
    minDate: 7,
    dateFormat: 'dd/mm/y',
    changeMonth: true,
    changeYear: true
    });
  } );
  </script>
</head>
<body>
<p>Date: <input type="text" class="DateFrom"></p>
</body>
</html>