无法正确获取eternicode Bootstrap datepicker的jQuery调用 [英] Cannot get jQuery call right for eternicode Bootstrap datepicker
问题描述
我一直在尝试eternicode/bootstrap-datepicker( https://github.com/eternicode /bootstrap-datepicker ).我尝试了沙箱( http://eternicode.github.io/bootstrap-datepicker/),只想使用突出显示今天"的组件"版本.
I have been trying out the eternicode/bootstrap-datepicker (https://github.com/eternicode/bootstrap-datepicker). I tried out the sandbox (http://eternicode.github.io/bootstrap-datepicker/) and just wanted to use the "Component" version with "Today" highlighted.
我有两个我认为是同一个问题的问题:1)仅当您单击input
空间时,单击glyphicon时日期才显示出来; 2)我无法获得今天"高尚的工作.
I have two problems which I think are the same thing: 1) the date doesn't show up when you click on the glyphicon only when you click in the input
space and 2) I cannot get the "Today" highight working.
我有99%的把握是jQuery调用错误.我已经尝试过各种方法使其按照Sandbox等触发,但是我的JS/jQuery不能胜任工作.
I am 99% sure it is the jQuery call that is wrong. I have tried all sorts to get it to fire as per Sandbox etc but my JS/jQuery is just not up to the job.
(时间选择器( https://github.com/jdewit/bootstrap-timepicker ),现在无需使用jQuery启动脚本即可正常运行).
(The timepicker (https://github.com/jdewit/bootstrap-timepicker) works fine without a jQuery launch script for now).
部分问题是,当我从GitHub下载zip时,有两个.less文件(我认为都是Bootstrap2).
Part of the problem is that when I download a zip from GitHub there are two .less files both of which (I think) are Bootstrap2.
感谢您的帮助.
<div class="form-group col-sm-3 colFlushL">
<label class="control-label" for="zaq-timeSimple">Time</label>
<div class="input-group bootstrap-timepicker timepicker colFlush ">
<input id="timepicker1" type="text" name="arse"
class="form-control">
<span class="input-group-addon"><i
class="glyphicon glyphicon-time"></i></span>
</div>
</div>
<div class="form-group col-sm-3 colFlush" id="zaq-startDate">
<label class="control-label" for="zaq-startDate">Start Date</label>
<div class="input-group colFlush">
<input type="text" class="form-control date" name="datepicker"
data-provide="datepicker">
<span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
</div>
这是我jQuery尝试的最新版本,我95%确信这很可怕.
Here is the latest version of my jQuery attempt which is I am 95% sure horrendous.
<script>
$('.datepicker.date').datepicker.(
{
todayHighlight: true
}
)
</script>
NB根据phpStorm,日期不是在我认为包含.less文件的任何地方定义的类
NB According to phpStorm date is NOT a class defined anywhere which I presume includes the .less file
PS,我应该说页面上的两个日期选择器是100%通过表单传递日期的值.
PS I should have said the two date pickers on the page ARE 100% passing the value of the dates through with the form.
推荐答案
好的,这是一个错字(或更准确地说,是对jQuery缺乏理解!)
OK this was a typo (or more accurately newb lack of jQuery understanding!!)
$('.datepicker.date').datepicker.(
应该是
$('.datepicker.date').datepicker(
IE我停留了额外的时间. (那花了我至少两个小时!D'哦!)
IE I stuck in an extra period. (And that cost me at least two hours! D'oh!)
这篇关于无法正确获取eternicode Bootstrap datepicker的jQuery调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!