简体   繁体   English

jQuery 日期选择器 javascript 语法问题

[英]jQuery date-picker javascript syntax problem

the error trying to do something simple but I got an error, I`ma beginner so I have a lot of syntax problems.错误试图做一些简单的事情,但我遇到了错误,我是初学者,所以我有很多语法问题。 thank you!谢谢你!

 <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>

Try this,尝试这个,

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM