如何在twitter-bootstrap的窗体中设置日期时间 [英] How to set the date-time in the form for twitter-bootstrap
本文介绍了如何在twitter-bootstrap的窗体中设置日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用twitter启动,我需要设置输入作为日期时间为表单中的一个标签,我不知道如何做。
I am using the twitter bootstrap and I need to set the input as date-time for one of the labels in the form and I am not sure how to do it..
我遵循这个原则:
https ://github.com/eternicode/bootstrap-datepicker ,我想尝试使用选项
我试过这样:
<link rel="stylesheet" type="text/css" href=""{{ STATIC_URL }}/css/datepicker.css">
<script src = "{{STATIC_URL}}js/Datepicker.js></script>
<script>
$('#datepicker').datepicker({
format: 'mm-dd-yyyy'
});
</script>
<label>Created:</label>
<input type="text" value="02-16-2012" id="datepicker" rel="datapicker" />
<br/><br/>
此外,我会使用标签显示当前日期而不是我最初键入的值。
Besides, i would take the label to show the current date instead of the value that i type i initially.
需要一些帮助。非常感谢任何帮助..
Need some help on it. Would really appreciate any help..
但它不工作...不知道什么错误是...
But it is not working... Not sure what the error was...
修改版本:
<link type="text/css" rel="stylesheet" href="{{ STATIC_URL }}/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href=""{{ STATIC_URL }}/css/datepicker.css">
<script>
$('#datepicker').datepicker({
format: 'mm-dd-yyyy'
});
</script>
<script src = "{{STATIC_URL}}js/Datepicker.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<label>Created:</label>
<input type="text" value ="06/11/2012"id="datepicker"/>
<br/><br/>
推荐答案
$('#datepicker').datepicker({
format: 'mm-dd-yyyy'
});
是jquery所以添加
is jquery so add
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
。
它适用于我 http://jsfiddle.net/baptme/9r2E4/
替换
<input type="text" value ="06/11/2012"id="datepicker"/>
使用
<input type="text" value="06-11-2012" id="datepicker"/>
这篇关于如何在twitter-bootstrap的窗体中设置日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文