admin管理员组文章数量:1313121
This is my datepicker field:
<div class="form-group">
<label for="exampleInputBday">Birthday</label>
<input type="text" name="bday" class="datepicker" required>
</div>
This is my javascript:
$(function(){
$('.datepicker').datepicker({
startDate: '-3y',
'format' : 'mm/dd/yyyy',
autoclose: true
})
})
})
When I open the datepicker, the start date is the current date! How to solve?
This is my datepicker field:
<div class="form-group">
<label for="exampleInputBday">Birthday</label>
<input type="text" name="bday" class="datepicker" required>
</div>
This is my javascript:
$(function(){
$('.datepicker').datepicker({
startDate: '-3y',
'format' : 'mm/dd/yyyy',
autoclose: true
})
})
})
When I open the datepicker, the start date is the current date! How to solve?
Share Improve this question asked Sep 17, 2013 at 20:01 user2297392user2297392 6-
what do you mean by startDate? jQuery's datepicker widget doesn't such an option. do you mean
minDate
? – gdoron Commented Sep 17, 2013 at 20:04 - The earliest date that may be selected; all earlier dates will be disabled. Is 'datepicker for boostrap' -> eternicode.github.io/bootstrap-datepicker – user2297392 Commented Sep 17, 2013 at 20:06
-
did you try
startDate: '-1095',
– adeneo Commented Sep 17, 2013 at 20:09 - Thanks, but not worked... – user2297392 Commented Sep 17, 2013 at 20:13
-
Not sure I get it,
startDate
sets the earliest date that may be selected; all earlier dates will be disabled. Is this not what you're trying to do? If not, you should read the documentation, all you have to do is set the value of the element to whatever date you choose ? – adeneo Commented Sep 17, 2013 at 20:34
1 Answer
Reset to default 2This should do the trick. When you are defining the date picker, you can use setDate option:
$(".datepicker").datepicker("setDate", "10/12/2013");
本文标签: javascriptSet 39Start Date39 on Datepicker for BootstrapStack Overflow
版权声明:本文标题:javascript - Set 'Start Date' on Datepicker for Bootstrap - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741927324a2405366.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论