Jquery datepicker格式完全失效

问题描述 投票:0回答:1

<!doctype html>
<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="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="https://code.jquery.com/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() {
    $( "#datepicker" ).datepicker({ format: 'yy-mm-dd' });
  } );
  </script>
</head>
<body>
 
<p>Date: <input type="text" id="datepicker"></p>
 
 
</body>
</html>

这是jquery UI网站的代码。

就像你看到的那样,这种格式根本就不能用!你知道为什么不能用吗?

你知道为什么它不工作吗?

jquery-ui
1个回答
1
投票

属性是不正确的......而非 format 应是 dateFormat:

因此,将其改为:

$( "#datepicker" ).datepicker({ format: 'yy-mm-dd' });

应该是:

$( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' });

API参考文献 此处.

© www.soinside.com 2019 - 2024. All rights reserved.