[英]Date picker issue - Bootstrap JS
I'm new to the scripting languages, I need help to resolve this issue. 我是脚本语言的新手,我需要帮助来解决此问题。 The bootstrap date picker resets the field when I choose the same date by using the date picker icon.
当我使用日期选择器图标选择相同的日期时,引导日期选择器将重置该字段。
$('#from_date .input-daterange').datepicker({
keyboardNavigation: false,
format: "dd-M-yyyy",
endDate: '+0d',
clearBtn: true,
forceParse: false,
autoclose: true,
});
My HTML line of code is as follows: 我的HTML代码如下:
<input type="text" style="margin-left: -5px; width: 99px;" class="form-control" id="fromdate"
name="quote-issue-date-start" placeholder="From date" data-bind="value:fromDate" />
<span class="input-group-addon">
<i class="fa fa-calendar"></i>
</span>
The textbox gets cleared when I again choose the date from the datepicker. 当我再次从日期选择器中选择日期时,文本框将被清除。
Many things look wrong: 许多事情看起来不对:
You try to select an element which does not exist: $('#from_date
- the id in your markup is fromdate
(withouth the underscore) 您尝试选择一个不存在的元素:
$('#from_date
标记中的id是fromdate
(没有下划线)
In your selector $('#from_date .input-daterange')
you try to select .input-daterange
inside #from_date
- if #from_date
is an <input>
element it cant have children, so the selector should be $('#from_date.input-daterange')
(if the input would actually have that class) 在你选择
$('#from_date .input-daterange')
大家尽量选择.input-daterange
内#from_date
-如果#from_date
是一个<input>
元素它不能有孩子,所以选择应该是$('#from_date.input-daterange')
(如果输入实际上具有该类)
You have a syntax error: 您有语法错误:
autoclose: true, });
The ,
is false here. ,
在这里是错误的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.