jQuery.Deferred exception: $(...).datepicker is not a function

thanks in advance.

I have already searched and implemented

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

and

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

but unable to resolve the issue. So, Please look at my code below and tel me what is the issue

<html> <head> <link href="" 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=""></script> <script src=""></script> <![endif]--> </head> <body> <div tabindex="-1" aria-hidden="true"> <div> <div> <a href="/"> <div> <div> </div> </div> </a> </div> <div> <div> <div> <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> <div></div> </div> <div> <div> <div> <label for="ProductName">Product Name</label> <span>*</span> </div> </div> <div> <div> <input name="ProductName" placeholder="Your Product Name *" value="" type="text"> <span></span> </div> </div> </div> <div> <div> <div> <label for="Stock">Stock</label> <span>*</span> </div> </div> <div> <div> <div> <div> <input name="Stock" placeholder="Your Stock *" value="0" type="text"> <span></span> </div> </div> <div> <div> <select 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> <div> <div> <label for="StockDate">Stock available on Date</label> <span>*</span> </div> </div> <div> <div> <input name="StockDate" value="01/01/0001" type="date"> <span></span> </div> </div> </div> <div> <div> <div> <label for="ProductDesc">Product Description</label> </div> </div> <div> <div> <textarea cols="20" name="ProductDesc" placeholder="Product Description" rows="2" type="text"></textarea> <span></span> </div> </div> </div> <div> <div></div> <div> <div></div> <button type="submit" 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> 

the date-time picker is not working on Mozilla Firefox.

4

1 Answer

$(…).datepicker is not a function

The Order of your script is wrong,

Jquery Library file should be always on top, then jquery-ui. Keep

modernizr-2.8.3.js

after

jquery-3.1.1.js and jquery-ui-1.12.1.js

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like