JS/jQuery TypeError: jQuery(…).datepicker is not a function Why ?

JS/jQuery TypeError: jQuery(…).datepicker is not a function Why ?

Asked on October 25, 2018 in Wordpress.
Add Comment


  • 4 Answer(s)

    There are many reasons for this error:

     

    • The jquery.ui is utilized before jquery.
    • The $ is utilized by another library.
    • The jquery lib that is referenced locally(wordpress) has diverse adaptation from
      that utilizing jquery.ui.
    • At the point when the correct library and form is referenced the program reserve must be cleared.

     

    Answered on October 25, 2018.
    Add Comment

    Try this code:

        <script>
        $.noConflict(); //Not to conflict with other scripts
    jQuery(document).ready(function($) {
    $( "#datepicker" ).datepicker({
        dateFormat:"yyyy-mm-dd",
        changeMonth: true,
        changeYear: true,
        maxDate: "+0D"
    });
     
    });
    </script>
    
    Answered on October 25, 2018.
    Add Comment

    The jquery.ui.datepicker.js it’s enclosed within the jquery package, but we still inquisitive we even have to incorporate this as a result of the victimisation jquery.ui before and also the jquery.ui.custom or just the jquery js file can do the .datepicker() operate on behalf of us.

    Answered on October 25, 2018.
    Add Comment
    require(['jquery', 'jqueryui'], function ($) {
        $(document).ready(function () {
            $("#form1").validationEngine({ bindButtons: $(".bindButton") });
    
            $("#txtBidDate").datepicker({dateFormat: 'mm-dd-yy'});
            $("#txtInstDate").datepicker({dateFormat: 'mm-dd-yy'});
        });
    Answered on February 18, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.