为什么这个日历不起作用?

时间:2016-06-01 04:55:53

标签: html css

我为日历编写了这段代码,它正在处理一个文件而不是另一个文件。看看:

   <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
        <link rel="stylesheet" href="style.css">
           <script>
        $(document).ready(function() {
            $( "#datepicker" ).datepicker();
        });
        </script>
        <p>Date: <input type="text" id="datepicker"></p>

为什么它只能处理一个文件?

3 个答案:

答案 0 :(得分:1)

如果有另一个库正在使用$变量,您可以这样做:

var $j = jQuery.noConflict();
$j(function() {
        $j( "#datepicker" ).datepicker();
});

答案 1 :(得分:0)

复制并粘贴此内容:

<!doctype html>

<head>
  <meta charset="utf-8">     
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>


<script>
    $(function() {
        $( "#datepicker" ).datepicker();
    });
</script>

</head>

 <body>    
   <p>Date: <input type="text" id="datepicker"></p>          
 </body>
</html>

答案 2 :(得分:0)

问题是你的JQuery-UI链接无效,修复它并且它会起作用。

https://jsfiddle.net/jamiguel77/atg5m6ym/

//code.jquery.com/ui/1.11.4/jquery-ui.js