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

App Dev 86 Reputation points
2021-06-14T21:18:00.053+00:00

Hi All,

Getting the following errors for trying get a datetime picker.

Create:247 Uncaught TypeError: $(...).datepicker is not a function
at Create:247
(anonymous) @ Create:247
Create:243 Uncaught TypeError: $(...).datepicker is not a function
at HTMLDocument.<anonymous> (Create:243)
at o (jquery-1.7.2.min.js:2)
at Object.fireWith (jquery-1.7.2.min.js:2)
at Function.ready (jquery-1.7.2.min.js:2)
at HTMLDocument.B (jquery-1.7.2.min.js:2)

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,254 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yijing Sun-MSFT 7,066 Reputation points
    2021-06-16T07:00:04.283+00:00

    Hi @App Dev ,
    According to your codes,you must add datepicker.js.You need to do like this:

    <s cript src="~/Scripts/jquery-1.12.4.min.js"></s cript>  
    <s cript>  
        $(function () {  
            $('#d').change(function () {  
                $('#z').datepicker('setDate', $(this).val());  
            });  
        })  
    </script>  
    <h2>Index</h2>  
    <input type="text" id="d" />  
    <div id="z"></div>  
      
    @section scripts  
    {  
        @Scripts.Render("~/Scripts/jquery-1.12.4.min.js")  
        @Scripts.Render("~/Scripts/bootstrap.min.js")  
        @Scripts.Render("~/Scripts/bootstrap-datepicker.min.js")  
        @Styles.Render("~/Content/bootstrap.min.css")  
        @Styles.Render("~/Content/bootstrap-datepicker.min.css")  
    }  
    

    By the way,if you need to post any codes,you could put codes into txt or screenshots to us.
    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments