1. ホーム
  2. javascript

[解決済み] jQuery.Deferred exception: $(...).datepicker は関数ではありません。

2022-02-14 13:28:21

質問

よろしくお願いします。

すでに検索して実装しています

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

そして

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

が、問題を解決できない。そこで、以下の私のコードを見て、何が問題なのか私に教えてください。

<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>

Mozilla Firefox で日付時刻のピッカーが動作しない。

どうすればいいですか?

<ブロッククオート

$(...).datepickerは関数ではありません。

スクリプトの順番が間違っています。

Jquery Libraryのファイルが常に一番上にあり、次にjquery-uiがあるはずです。 キープ

modernizr-2.8.3.js

jquery-3.1.1.jsと jquery-ui-1.12.1.js