jQuery datepicker() Uncaught TypeError: undefined is not a function

前端 未结 5 1980
梦谈多话
梦谈多话 2021-01-11 16:04

Can anyone please help me I am struggling with this problem for the past few day. Actually I included all the necessary plugins\' but still the

$(\'#datepicke

相关标签:
5条回答
  • 2021-01-11 16:12

    If you are using Wordpress, make sure you replace "$" with "jQuery" in the .js files.

    0 讨论(0)
  • 2021-01-11 16:13

    I just had this issue and solved it using $.noConflict();:

    Instead of $( '#datepicker' ).datepicker();, I used:

    $.noConflict();
    jQuery(document).ready(function ($) {
        $("#datepicker").datepicker();
    });
    
    0 讨论(0)
  • 2021-01-11 16:21

    Please double check the js files you include if you include the same js file twice are different version of same file twice, It will conflict. Have patient to go through to entire jsp or html file to check the js files.

    0 讨论(0)
  • 2021-01-11 16:25

    check the reference what you have added and the reference what you have in the scripts folder. example: if you have referred [jquery-ui.min.js] in your .cshtml but you have [jquery-ui.min-1.13.0.js] in your scripts folder then this error will occurs

    0 讨论(0)
  • 2021-01-11 16:36

    Spent lots of time on this. Found the issue to datepicker function not found and or not working in Chrome. Using VS2015... Just about everything is dependant on JQuery so it must be at the very top. Use the following references or latest:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
        <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css" />
        <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
    
    1. Open _layout.cshtml
    2. Paste at the top of each Environment section. Check the body as well. (I was missing the body)
    0 讨论(0)
提交回复
热议问题