简体   繁体   English

Uncaught TypeError:undefined不是一个函数jquery.datetimepicker.js:1619(匿名函数)

[英]Uncaught TypeError: undefined is not a function jquery.datetimepicker.js:1619(anonymous function)

I try to use jquery.datetimepicker in my Symfony 2.7 project but when I call datetimepicker in my view not load the date and time. 我尝试在Symfony 2.7项目中使用jquery.datetimepicker,但是当我在视图中调用datetimepicker时,不会加载日期和时间。 The console show this error: 控制台显示此错误:

Uncaught TypeError: undefined is not a function jquery.datetimepicker.js:1619(anonymous function) Uncaught TypeError:undefined不是一个函数jquery.datetimepicker.js:1619(匿名函数)

This is my code: 这是我的代码:

<div class="contact">
                    <div class="company_address">

                        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages.</p>
                    </div>
                    <div class="contact-form" >
                        {{ form(form) }}
                        <button type="submit" class="cancel" name="cancel" onclick="location.href = '{{ path('assistance_list') }}'">Cancel</button>

                    </div>

                    <div class="clear"></div>
                    <script>
                        $(document).ready(function () {

                            $.datetimepicker.setLocale('en');

                            $("#daiquiri_daiquiribundle_assistance_date input").each(function () {
                                $(this).attr("readonly", "readonly");
                            });

                            $('#daiquiri_daiquiribundle_assistance_date_date').datetimepicker({
                                format: "Y-m-d",
                                timepicker: false,
                                datepicker: true,
                                theme: 'dark'
                            });
                            $('#daiquiri_daiquiribundle_assistance_date_time').datetimepicker({
                                format: "H:i",
                                timepicker: true,
                                datepicker: false,
                                step: 10,
                                theme: 'dark'
                            });

                        });
                    </script>
                </div>

When you are using said function name that you KNOW is a jQuery method name, and this error is returned, it is 100% a typo on your behalf, or the jQuery library is not loaded correctly. 当您使用上述函数名称时,您知道KNOW是jQuery方法名称,并且会返回此错误,它代表您输入错误100%,或者jQuery库未正确加载。 Since the document ready works, but not this method, that says jQuery is loaded correctly, but not the source library for the datetimepicker method. 由于文档可以使用,但不能使用该方法,因此表示jQuery已正确加载,但datetimepicker方法的源库未正确加载。 If you are in chrome, hit F12, and then check your resources or console. 如果您使用的是Chrome浏览器,请点击F12,然后检查您的资源或控制台。 The console should say something along the lines of "Failed to load resource" if you have a link to it, but it is incorrect. 如果您有控制台的链接,则控制台应该说“无法加载资源”,但它是不正确的。 If you have not loaded it at all, the library you need for those plugins are here: https://jqueryui.com/ 如果您根本没有加载它,那么这些插件所需的库在这里: https : //jqueryui.com/

Sorry for this question, It is my error I am trying to load : 抱歉,这个问题是我要加载的错误:

<link rel="stylesheet" type="text/css" href="jquery.datetimepicker.css"/ >
<script src="jquery.js"></script>
<script src="jquery.datetimepicker.js"></script>

When it should load: 何时加载:

<link rel="stylesheet" type="text/css" href="jquery.datetimepicker.css"/ >
<script src="jquery.js"></script>
*<script src="jquery.datetimepicker.full.js"></script>*

With this change solved the problem. 通过此更改解决了问题。 Thanks to all for your help. 感谢大家的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获的TypeError:i.dateFormat不是jquery.datetimepicker.min.js中的函数:2(匿名) - Uncaught TypeError: i.dateFormat is not a function at jquery.datetimepicker.min.js:2 (anonymous) 未捕获的TypeError:undefined不是initslider-1.js:1函数(匿名函数)AmazingSlider - Uncaught TypeError: undefined is not a function initslider-1.js:1 (anonymous function) AmazingSlider 未捕获的TypeError:undefined不是函数(匿名函数) - Uncaught TypeError: undefined is not a function(anonymous function) 未捕获的TypeError未定义不是函数匿名函数 - Uncaught TypeError undefined is not a function anonymous function 未捕获的TypeError:undefined不是datepair()的函数(匿名函数); - Uncaught TypeError: undefined is not a function(anonymous function) for datepair(); jQuery的,遗漏的类型错误:未定义是不是一个函数 - Jquery, Uncaught TypeError: undefined is not a function 未捕获的TypeError:undefined不是jQuery的函数 - Uncaught TypeError: undefined is not a function with jQuery 未捕获的TypeError:undefined不是函数-不是JQuery - Uncaught TypeError: undefined is not a function - not JQuery 未捕获的TypeError:undefined不是函数jquery - Uncaught TypeError: undefined is not a function jquery BootStrap:未捕获的TypeError:$(...)。datetimepicker不是函数 - BootStrap : Uncaught TypeError: $(…).datetimepicker is not a function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM