I have an @Html.edifor to show date of birth and I want to use jquery datepicker to show calendar. My scritp code is located in an external js file and proper reference to the file is on the view. I am also using bundle in app config.
here is my script
$(function ()
{
$("#DateOfBirth").datepicker({ dateFormat: "dd-MMM-yy", changeMonth: true, changeYear: true });
});
I am getting the following error. Jquery?v=gywVLk6VvVVR_J6-oRPIvBpBvXSXEW6ZffeMhgu--bE1:1 Uncaught TypeError: $(...).datepicker is not a function.
Can someone help me spot what is wrong.
Thank you!
Sachin SinghPosted Oct 12, 2020, 11:18 PM
- there might be a reference of Jquery in Layout by means of Bundle or directly.
- You are also referencing any jquery file in the view where there is datepicker.
Solution is to check how many times Jquery is being loaded by inspecting the console with developer tool and remove any reference of jquery loaded more than once.Mageshwaran RPosted Oct 12, 2020, 9:55 PM
Mageshwaran RPosted Oct 12, 2020, 9:52 PM