web-dev-qa-db-fra.com

exception jQuery.Deferred: $ (...). datepicker n'est pas une fonction

merci d'avance.

J'ai déjà cherché et mis en place 

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

et 

$(function () {
    if (!Modernizr.inputtypes.date) {
        $('input[type=date]').datepicker({
            dateFormat: 'dd-mm-yyyy'
        }
         );
    }
});

mais incapable de résoudre le problème. Alors, s'il vous plaît regardez mon code ci-dessous et dites-moi quel est le problème

<html class=" js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths" style="">
<head>
  <link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
    <link href="/Content/bootstrap.min.css" rel="stylesheet">
    <link href="/Content/font-awesome.min.css" rel="stylesheet">
    <link href="/Content/animate.css" rel="stylesheet">
    <link href="/Content/style.css" rel="stylesheet">
    <script src="/Scripts/modernizr-2.8.3.js"></script>
    <!-- Tweaks for older IEs-->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>

    <div class="section-modal modal fade in" id="new-product-modal" tabindex="-1" role="dialog" aria-hidden="true" style="display: block;overflow-y:scroll;">
        <div class="modal-content">
            <div class="close-modal" data-dismiss="modal">
                <a href="/">
                    <div class="lr">
                        <div class="rl">
                        </div>
                    </div>
                </a>
            </div>
            <div class="container">
                <div class="row">
                    <div class="section-title text-center">
                        <h3>Products</h3>
                        <p>Add a new product into List</p>
                    </div>
                </div>
                <form returnurl="" action="/Home/Products" enctype="multipart/form-data" method="post">
                    <input name="__RequestVerificationToken" value="Cni4uRd3UIZMvQsCWzpt3GQRxRmybm2yKX2xsOHkvS2D_f4qezvaBU38Mg6HYOJZwwe7bIYpjvWSgYOzdA2LxN3MBxG8uGvvB4-xN4W1LK41" type="hidden">                <div class="row form-group warning-message-container">
                        <div class=" danger" style="color:red;background-color:lightpink;border-radius:0.3em;text-align:center;"></div>
                    </div>
                    <div class="row">
                        <div class="col-md-3">
                            <div class="form-group text-right">
                                <label class="form-label" for="ProductName">Product Name</label> <span style="color:red;">*</span>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <input class="form-control" data-val="true" data-val-required="The ProductName field is required." id="name" name="ProductName" placeholder="Your Product Name *" value="" type="text">
                                <span class="field-validation-valid" data-valmsg-for="ProductName" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                    </div>
                     <div class="row">
                        <div class="col-md-3">
                            <div class="form-group text-right">
                                <label class="form-label" for="Stock">Stock</label> <span style="color:red;">*</span>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <div class="row form-group">
                                        <input class="form-control" data-val="true" data-val-number="The field Stock must be a number." data-val-required="The Stock field is required." id="name" name="Stock" placeholder="Your Stock *" value="0" type="text">
                                        <span class="field-validation-valid" data-valmsg-for="Stock" data-valmsg-replace="true"></span>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <select class="form-control" data-val="true" data-val-number="The field Stock Unit must be a number." data-val-required="The Stock Unit field is required." id="StockUnit" name="SelectedStockUnit" placeholder="Select Unit *">
                                            <option selected="selected" value="0">Select a Unit</option>
                                            <option value="1">Kilogram</option>
                                            <option value="2">Grams</option>
                                            <option value="3">Ton</option>
                                            <option value="4">Liter</option>
                                            <option value="5">Dozen</option>
                                            <option value="6">Quintel</option>
                                            <option value="7">Milli Gram</option>
                                            <option value="8">Peices</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                     <div class="row">
                        <div class="col-md-3">
                            <div class="form-group text-right">
                                <label class="form-label" for="StockDate">Stock available on Date</label> <span style="color:red;">*</span>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <input class="text-box single-line" data-val="true" data-val-date="The field Stock on Date must be a date." data-val-required="The Stock on Date field is required." id="StockDate" name="StockDate" value="01/01/0001" type="date">
                                <span class="field-validation-valid" data-valmsg-for="StockDate" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                    </div>
                        <div class="row">
                        <div class="col-md-3">
                            <div class="form-group text-right">
                                <label class="form-label" for="ProductDesc">Product Description</label>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <textarea class="form-control" cols="20" id="ProductDesc" name="ProductDesc" placeholder="Product Description" rows="2" type="text"></textarea>
                                <span class="field-validation-valid" data-valmsg-for="ProductDesc" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="clearfix"></div>
                        <div class="col-lg-12 text-center">
                            <div id="success"></div>
                            <button type="submit" class="btn btn-primary" value="Save">Save</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>


    <script src="/Scripts/jquery-ui-1.12.1.js"></script>
    <script src="/Scripts/jquery-3.1.1.js"></script>
    <script src="/Scripts/jquery.appear.js"></script>
    <script src="/Scripts/bootstrap.js"></script>
    <script src="/Scripts/Custom/DatePickerReady.js"></script>
    <script src="/Scripts/respond.matchmedia.addListener.js"></script>
    <script src="/Scripts/respond.js"></script>
    <script src="/Scripts/Custom/dropdownlist.js"></script>
    <script src="/Scripts/script.js"></script>


</body>
</html>

le sélecteur de date/heure ne fonctionne pas sur Mozilla Firefox.

5
Abhishek Pandey

$ (…) .Datepicker n'est pas une fonction

L'ordre de votre script est faux,

Le fichier Jquery Library doit toujours être au-dessus, puis jquery-ui . Keep 

modernizr-2.8.3.js

après 

jquery-3.1.1.js et jquery-ui-1.12.1.js

5
Minksmnm

Les positions d'importation du fichier de script ne sont pas correctes. Essayez de changer les commandes de fichiers de script lors de l’importation.

0
Saroj Dahal