日期选择器麻烦

问题描述:

嗨,我不能让这个datepicker工作?有人可以帮助我使它起作用吗,当我点击它时,它无所作为!日期选择器麻烦

它是从这个网站我试图让他们的例子。

链接:http://jsfiddle.net/jasenhk/4g9u5/

HEAD:

<head> 

<!--Bootstrap stylesheet--> 
<link rel="stylesheet" href="css/bootstrap.min.css"> 

<!--Bootstrap scripts--> 
<script src="js/bootstrap.min.js" type="text/javascript"></script> 



<!--Custom stylesheets--> 
<link rel="stylesheet" type="text/css" href="css/style.css"> 

<!--Custom scripts--> 
<script src="http://code.jquery.com/jquery-latest.min.js"</script> 

<script> 
$(document).ready(function() { 
    $(".date-picker").datepicker(); 

    $(".date-picker").on("change", function() { 
     var id = $(this).attr("id"); 
     var val = $("label[for='" + id + "']").text(); 
     $("#msg").text(val + " changed"); 
    }); 
}); 
</script> 
</head> 

BODY:

<div class="controls"> 
    <div class="input-group"> 
    <label for="date-picker-3" class="input-group-addon btn"> 
     <span class="glyphicon glyphicon-calendar"></span> 
    </label> 
    <input id="date-picker-3" type="text" class="date-picker form-control 
hasDatepicker"> 
    </div> 
</div> 
+0

适合我。噢,你的意思是你不能在你的网站上工作?我会猜测你没有包含jQuery或其他库。 – Ruddy

+0

问题是什么?控制台中的任何错误? – Tushar

+0

在引导之前包含jQuery。并且包含jQuery UI文件 –

你必须从你的输入中删除hasDatepicker类。此外,您的HTML格式有误:

<input id="date-picker-3" type="text" class="date-picker form-control" /> 

而且你的jQuery脚本标记也畸形:

<!--Custom scripts--> 
<script src="http://code.jquery.com/jquery-latest.min.js"></script> 

而你错过了jQuery用户界面:

<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> 

这里是的jsfiddle工作例如:http://jsfiddle.net/054xstp5/15/