jquery - jQuery日期选择器没有输出
问题描述
如果我在单独的文件中运行相同的代码,它运行的代码。
$("#datepicker").datepicker();
<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>
<input type="text" id="datepicker">
解决方案
看起来您错过了 JQuery Datepicker 中的主题 css 库:
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
请看一下运行良好的示例:
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Datepicker- Solution</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() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"></p>
</body>
</html>
推荐阅读
- javascript - 基于多个值过滤 JavaScript 数组
- java - 清除 Android 应用程序通知 (Java)
- influxdb - 每小时 InfluxDB 总消息数
- arrays - 数组差异 IF/OR VBA 脚本
- textarea - 如何在屏幕加载时以角度设置文本区域的自动高度
- javascript - 无法在 JSON.parse 中创建长度超过 0x1fffffe8 个字符的字符串?
- python - 在numpy数组中获得最大上升
- javascript - 为什么在复选框的“其他”选项中提交带有回复的谷歌表单没有反映在个人回复中?
- spring - 如何在 SpringMVC 的控制器中获取具有不同名称的单选按钮值集
- laravel - 将数据从插槽内的子组件传递到父组件(vue.js)