【发布时间】:2016-09-12 03:59:45
【问题描述】:
Datepicker 无法在此页面运行,但导入了 jquery-ui 的脚本。 冲突在哪里?谢谢。 日期选择器不是函数 这是我的脚本
$( document ).ready(function() {
var fecha = "";
$( "#datepicker" ).datepicker({
dateFormat: "yy-mm-dd",
});
});
$( "#datepicker" ).change(function(){
fecha = this.value;
$.post( "tablaUsuarioPlanta.php",{fecha : fecha},function(data){
$("#tabla").html(data);
});
});
这是 HTML
<p>Date: <input type="text" id="datepicker" size="30"></p>
脚本加载到页面上
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"> </script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<!-- Bootstrap Core CSS -->
<link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="../css/simple-sidebar.css" rel="stylesheet">
<!--JQUERY-->
<!--<script src="../js/jquery.js"></script>-->
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
【问题讨论】:
-
你为什么添加了两次code.jquery.com/ui/1.10.2/jquery-ui.js文件???
-
检查您是否在 datepicker 代码之后不加载 jquery 和 jquery-ui 库。 JSfiddle 的例子最好。
标签: javascript jquery html