datetimepicker is not a function jquery

前端 未结 6 1462
梦毁少年i
梦毁少年i 2020-12-17 15:37

I working with datetimepicker jquery ui, when code below html , datetimepicker is not displaying and when i inspect with firebug console it displayed an error `

相关标签:
6条回答
  • 2020-12-17 15:39

    Keep in mind, the jQuery UI's datepicker is not initialized with datetimepicker(), there appears to be a plugin/addon here: http://trentrichardson.com/examples/timepicker/.

    However, with just jquery-ui it's actually initialized as $("#example").datepicker(). See jQuery's demo site here: http://jqueryui.com/demos/datepicker/

       $(document).ready(function(){
            $("#example1").datepicker();
        });
    

    To use the datetimepicker at the link referenced above, you will want to be certain that your scripts path is correct for the plugin.

    0 讨论(0)
  • 2020-12-17 15:43
     $(document).ready(function(){
        $("#example1").datetimepicker({
          allowMultidate: true,
          multidateSeparator: ','
        });
     });
    
    0 讨论(0)
  • 2020-12-17 15:47

    It's all about the order of the scripts. Try to reorder them, place jquery.datetimepicker.js to be last of all scripts!

    0 讨论(0)
  • 2020-12-17 15:50

    For some reason this link solved my problem...I don't know why tho..

    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
    

    Then this:

    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
    

    NOTE: I am using Bootstrap 3 and Jquery 1.11.3

    0 讨论(0)
  • 2020-12-17 15:58
    Place your scripts in this order:   
    
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    
        <!-- Optional theme -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.min.css" />
    
        <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>   
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    
        <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
    
    0 讨论(0)
  • 2020-12-17 16:02

    I had the same problem with bootstrap datetimepicker extension. Including moment.js before datetimepicker.js was the solution.

    0 讨论(0)
提交回复
热议问题