JQuery UI - 无法获取datepicker工作 [英] JQuery UI - Can't get datepicker to work

查看:96
本文介绍了JQuery UI - 无法获取datepicker工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题很简单。我正确地包含所有内容,但是datepicker不会出现。我的html头标记中添加了脚本:

 < script type =text / javascriptsrc =< ?php echo site_url('js / jquery-1.10.2.min.js');?>>< / script> 
< script type =text / javascriptsrc =http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js>< /脚本>
< link rel =stylesheethref =<?php echo site_url('css / jquery.ui.core.css');?>>
< link rel =stylesheethref =<?php echo site_url('css / jquery.ui.datepicker.css');?>>

比日期选择器代码...

 < input type =textname =dateid =date> 
< script type =text / javascript>
$(document).ready(function(){
$(#date).datepicker({dateFormat:yy-m-d});
});
< / script>

就是这样。没有日期选择器或该文本输入上的任何内容。也没有错误...:(

解决方案

包含jquery之前jquery ui。

 < script src =http://code.jquery.com/jquery-1.9.1.js>< / script> 
<脚本src =http://code.jquery.com/ui/1.10.3/jquery-ui.js>< / script>

工作代码

 < link rel =stylesheethref =http ://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css/> 

< script src =http://code.jquery。 com / jquery-1.9.1.js>< / script>
< script src =http://code.jquery.com/ui/1.10.3/jquery-ui.js> ;< / script>
< script>
$(function(){
$(#date).datepicker();
});
< / script>

日期:


The question is very simple. I have everything included properly, but the datepicker just won't show up. I have the script added in my html head tag:

<script type="text/javascript" src="<?php echo site_url('js/jquery-1.10.2.min.js'); ?>"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
<link rel="stylesheet" href="<?php echo site_url('css/jquery.ui.core.css'); ?>">
<link rel="stylesheet" href="<?php echo site_url('css/jquery.ui.datepicker.css'); ?>">

Than the date picker code...

<input type="text" name="date" id="date">
<script type="text/javascript">
    $(document).ready(function() {
        $( "#date" ).datepicker({ dateFormat: "yy-m-d" });  
    });
</script>

And that's it. There's no date picker or anything on that text input. Also no error... :(

解决方案

include jquery before jquery ui.

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

working code

  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {
   $( "#date" ).datepicker();
 });
</script>

Date:

这篇关于JQuery UI - 无法获取datepicker工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆