eureka2 / ab-datepicker

An accessible and bootstrap compatible datepicker
MIT License
63 stars 55 forks source link

Why when the datepicker is initialized in javascript, the html page is scrolled up? #66

Open kobazzo opened 3 years ago

kobazzo commented 3 years ago

I have an html page, laravel blade exactly, on the top i have two input type=text used with datepicker. The problem is that when the datepicker is initialized in javascript, the html page is scrolled up. This is the code that i've put at the bottom of the page:

<script type="text/javascript">
        $(document).ready(function () {            
            $('.date').datepicker({
                firstDayOfWeek: 1,
                weekDayFormat: 'narrow',
                inputFormat: 'd/M/y',
                outputFormat: 'd/M/y',
                markup: 'bootstrap4',
                theme: 'bootstrap',
                modal: false
            });
        });
    </script>
emircano84 commented 3 years ago

You need to use gainFocusOnConstruction to false