简体   繁体   中英

Set 'Start Date' on Datepicker for Bootstrap

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 should do the trick. When you are defining the date picker, you can use setDate option:

$(".datepicker").datepicker("setDate", "10/12/2013");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM