JQuery's multiDatesPicker is not a function

1.5k Views Asked by At

I am trying to code a very simple build of the MultiDatesPicker jquery plugin. But I'm getting the following errors:

Uncaught TypeError: $(...).multiDatesPicker is not a function

Here's what I have so far:

Script and CSS files in head

<head>
    <script src="~/js/jquery-3.5.1.min.js"></script>
    <script src="~/js/jquery-ui-1.12.1/jquery-ui.js"></script>
    <script src="~/Multiple-Dates-Picker-for-jQuery-UI-latest/jquery-ui.multidatespicker.js"></script>

    <link rel="stylesheet" type="text/css" href="~/js/jquery-ui-1.12.1/jquery-ui.css">
    <link rel="stylesheet" type="text/css" href="~/Multiple-Dates-Picker-for-jQuery-UI-latest/jquery-ui.multidatespicker.css">

    <script>
        $(document).ready(function () {
            $('#mdp-demo').multiDatesPicker();
        });
    </script>
</head>

Jquery Script

<script>
    $(document).ready(function () {
        $('#mdp-demo').multiDatesPicker();
    });
</script>

HTML

<input id="mdp-demo">
1

There are 1 best solutions below

5
Joel Hager On

You want to call jQueryUI before you call the datePicker script. It depends on the library. Just change the order of your scripts to have jQueryUI before multidatespicker.

From the docs: enter image description here

https://portail.ac-amiens.fr/imagin/ressources/webfusion/jqueryUI-component/multidatespicker/