jQuery 日曆 datepicker

Step
1.add textbox
2.import js
3.bind textbox & datepicker

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <title></title>    <link rel="stylesheet" href="//code.jquery.com/ui/1.13.1/themes/base/jquery-ui.css">    <link rel="stylesheet" href="/resources/demos/style.css">    <script src="https://code.jquery.com/jquery-3.6.0.js"></script>    <script src="https://code.jquery.com/ui/1.13.1/jquery-ui.js"></script>    <script type="text/javascript">        $(function () {            $("#txt_DATE").datepicker({ dateFormat: 'yy/mm/dd' }).val();        });    </script></head><body>    <input id="txt_DATE" type="text" /></body></html>

结果:
画面就会像这样,点一下txt_DATE,会跳出日曆可以选日期,选完日期,值放到txt_DATE
*日期会依我们设的dateformat做显示.
http://img2.58codes.com/2024/20106764KUs0lcD5Bd.png

aspx的control也可以

        <asp:TextBox ID="txt_DATE" runat="server"></asp:TextBox>

ref
js datepicker
https://jqueryui.com/datepicker/

datepicker format
https://stackoverflow.com/questions/1328025/jquery-ui-datepicker-change-date-format


关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章