jQuery(...).kendoDatePicker is not a function

Viewed 6855

Risking to get my reputation downsized, I am new to Kendo UI and stuff, and I read a lot about this error, but couldn't find anything to help me.

Here is my view

@model ClothingSite.Models.Register
@using Kendo.Mvc.UI;
@{
    ViewBag.Title = "ThunderBird Clothes";
}
<head>
    <script src="@Url.Content("~/Scripts/jquery.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo.web.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo.aspnetmvc.min.js")"></script>

</head>

<h2>Title Legend</h2>
@(Html.Kendo().DatePicker().Name("Birthday"))
<link rel="stylesheet" href="@Url.Content("~/Content/styles/kendo.common.min.css")">
<link rel="stylesheet" href="@Url.Content("~/Content/styles/kendo.default.min.css")">

Am I missing any reference?I have the scripts from the Free Trial Telerik Kendo UI And the full error

IndexButton:78 Uncaught TypeError: jQuery(...).kendoDatePicker is not a function at HTMLDocument. (IndexButton:78) 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)

2 Answers

I resolved this issue by ensuring there weren't duplicate calls to jquery. In my case (I'm using ASP.Net Core) I found a reference to jquery.min.js in the default layout of the application, e.g.

        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
            asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
            asp-fallback-test="window.jQuery"
            crossorigin="anonymous"
            integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=">

I also was including Telerik's supported version of JQuery using this link (Note the version numbers in the url that should match the version of Telerik you are using):

    <script src="https://kendo.cdn.telerik.com/2019.2.619/js/jquery.min.js"></script>

My fix was simply to remove the version that came with my template and used the tested version with Telerik.

Related