Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?


1 Answers

This should do the trick. When you are defining the date picker, you can use setDate option:

$(".datepicker").datepicker("setDate", "10/12/2013");
like image 70
Caner Akdeniz Avatar answered Mar 30 '26 03:03

Caner Akdeniz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!