jQuery Mobile - 文本输入时间和颜色
描述
时间输入类型允许用户输入根据 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>Time Input Example</h2>
<label for = "src">Time Input</label>
<input type = "time" id = "src" data-clear-btn = "false">
<label for = "src1">Clear the Time Field</label>
<input type = "time" data-clear-btn = "true" id = "src1">
<h2>Color Input Example</h2>
<label for = "src2">Color Input</label>
<input type = "color" id = "src2" data-clear-btn = "false">
<label for = "src3">Clear the Color Field</label>
<input type = "color" data-clear-btn = "true" id = "src3">
</form>
</body>
</html>
输出
让我们执行以下步骤,看看上面的代码是如何工作的 −
将上述 html 代码保存为服务器根文件夹中的 textinput_time_color.html 文件。
将此 HTML 文件打开为 http://localhost/textinput_time_color.html,将显示以下输出。

