Uncaught TypeError: undefined is not a function for date picker bootstrap

10,712

Had same problem, in my case it was fact taht I have included bootstrap-datepicker.js earlier than bootstrap.min.js . After moving bootstrap-datepicker.js to footer - everything goes fine.

Share:
10,712
John Jerrby
Author by

John Jerrby

Now trying to learn .Net

Updated on June 14, 2022

Comments

  • John Jerrby
    John Jerrby almost 2 years

    I wanted to use datepicker of bootstrap ,what I use this code I got error

    Uncaught TypeError: undefined is not a function Create:283
    (anonymous function) Create:283
    n.Callbacks.j jquery-2.1.1.min.js:2
    n.Callbacks.k.fireWith jquery-2.1.1.min.js:2
    n.extend.ready
    

    In this code which having the error,I took it from bootstrap site as-is...

    <script type="text/javascript">
        $(function () {
            $('#datetimepicker4').datepicker({
            });
        });
    </script>
    

    this is the Div

    <div class="well">
        <div id="datetimepicker4" class="input-append">
            <input data-format="yyyy-MM-dd" type="text" />
            <span class="add-on">
                <i data-time-icon="icon-time" data-date-icon="icon-calendar">
                </i>
            </span>
        </div>
    </div>
    

    This is the libaray which I use and it doesnt help. I try to add them one by one to see if this problem is solving but not ,any clue?

    <script src="~/Scripts/jquery-2.1.1.min.js"></script>
    <script src="~/Scripts/bootstrap-datepicker.js"></script>   
    <script src="~/Scripts/moment-datepicker.js"></script>          
    <script src="~/Scripts/moment.min.js"></script>
    <script src="~/Scripts/moment.js"></script>
    <link href="~/Content/bootstrap-datepicker.css" rel="stylesheet" />        
    <link href="~/Content/bootstrap-datepicker3.css" rel="stylesheet" />  
    <link href="~/Content/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/moment-datepicker/datepicker.css" rel="stylesheet" /> 
    
    
    
    <script type="text/javascript" src="../../Scripts/Create.js"></script>