Click here to Skip to main content
15,907,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Team

I want to create datepicker, somehow when i debug i often get this annoying error as "
Index:187 Uncaught TypeError: $(...).datepicker is not a function
    at HTMLDocument.<anonymous> (Index:187)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at Function.ready (jquery.min.js:2)
    at HTMLDocument.K (jquery.min.js:2)
". Have a look at my libraries and yet Datepicker is already installed on Nuget command.

What I have tried:

// Libraries imported on View.cshtml
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>

<link rel="stylesheet" href="">
<link rel="stylesheet" href="">

<div class="form-group">
                <label asp-for="Date_Created" class="control-label"></label>
                <input asp-for="Date_Created" id="datepicker" type="text" class="form-control" value="@DateTime.Now.ToString("yyyy-MM-ddThh:mm")" />
                <span asp-validation-for="Date_Created" class="text-danger"></span>
                $(document).ready(function () {
                        dateFormat: "dd-mm-yy",
                        changemonth: true,
                        changeyear: true

    <!---Adding a picture for customization-->
    <div class="container body-content">
        <hr />


    @RenderSection("scripts", required: false)
Updated 9-Nov-21 2:20am

1 solution

In the browser, check the developer tools window and see if the bootstrap-datetimepicker.min.js file is actually being found and loaded.
Share this answer
Gcobani Mkontwana 2021 9-Nov-21 8:52am    
@realJSOP its complain it does not. what could i be missing based on the libraries used and nuget install on my VS IDE
#realJSOP 9-Nov-21 8:55am    
I have no idea why it wouldn't be found. I just pasted the url for it into my browser, and it came up fine. Personally, I would *never* load a css or javascript file from a remote location, because if that remote location goes away or goes down, so does *my* web site. Beyond that, DNS attacks on cloudflare happen with all too much regularity.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900