日期、月份和星期文本输入
描述
Date 日期输入类型 属性允许用户输入根据 ISO 8601 编码的日期(年、月、日)。
Month 月输入类型 允许用户选择由年和月组成的日期,根据 ISO 8601 编码。
Week 星期输入类型 允许用户选择由年份和星期数字组成的日期,这些数字根据 ISO 8601 编码。
示例
以下示例演示了在 jQuery Mobile 中使用日期、月份和星期输入。
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<form>
<h2>Date Input Example</h2>
<label for = "src">Date Input</label>
<input type = "date" id = "src" data-clear-btn = "false">
<label for = "src1">Clear the Date input Field</label>
<input type = "date" data-clear-btn = "true" id = "src1">
<h2>Month Input Example</h2>
<label for = "src2">Month Input</label>
<input type = "month" id = "src2" data-clear-btn = "false">
<label for = "src3">Clear the Month input Field</label>
<input type = "month" data-clear-btn = "true" id = "src3">
<h2>Week Input Example</h2>
<label for = "src4">Week Input</label>
<input type = "week" id = "src4" data-clear-btn = "false">
<label for = "src5">Clear the Week input Field</label>
<input type = "week" data-clear-btn = "true" id = "src5">
</form>
</body>
</html>
输出
让我们执行以下步骤,看看上面的代码是如何工作的 −
将上述 html 代码保存为服务器根文件夹中的 textinput_date_month_week.html 文件。
将此 HTML 文件打开为 http://localhost/textinput_date_month_week.html,将显示以下输出。

