与Modernizr.Load未捕获TypeError [英] Uncaught TypeError with Modernizr.Load

查看:159
本文介绍了与Modernizr.Load未捕获TypeError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码来让我使用datepicker。虽然我以前有这个工作的变化,我现在无法让它恢复工作。



我收到错误'未捕获类型错误:未定义不是功能'在'Modernizr.load'下面

 < script> 
Modernizr.load({
test:Modernizr.inputtypes.date,
nope:['http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery .min.js','http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js','jquery-ui.css'],
完成:function(){
if(window.jQuery){
jQuery('input [type = date]')。datepicker({
dateFormat:'yy-mm-dd'
});
}
}
});



有什么建议这个错误的原因是?

解决方案

我刚刚粘贴了一个简单的modernizr自定义构建在你的


I'm trying to get the following code to work allowing me to use the datepicker. Whilst I have had a variation of this working previously I'm now unable to get it working after a restore.

I get the error 'Uncaught TypeError: undefined is not a function' below the line 'Modernizr.load'

    <script>
Modernizr.load({
  test: Modernizr.inputtypes.date,
  nope: ['http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js', 'jquery-ui.css'],
    complete: function () {
        if (window.jQuery) {
            jQuery('input[type=date]').datepicker({
                dateFormat: 'yy-mm-dd'
            });
        }
    }
});

Any suggestions as to what the cause of this error is?

解决方案

I just pasted a simple modernizr custom build in your fiddle which seems to work for firefox:

However, I had to change the way you load jquery-ui: simply replace that cdn with your desired theme:

    nope: [
      'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js',
      'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js', 
      'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css'],
    ....

Mins was right, here the custom build:

这篇关于与Modernizr.Load未捕获TypeError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆