简体   繁体   English

jquery-ui.js:12443未捕获的TypeError:无法读取undefined的属性'apply'

[英]jquery-ui.js:12443 Uncaught TypeError: Cannot read property 'apply' of undefined

I have written this code in my project and it is displaying the error: 我在我的项目中编写了这段代码并显示错误:

Uncaught TypeError: Cannot read property 'apply' of undefined 未捕获的TypeError:无法读取未定义的属性“apply”

if (TempData["notice"] != null)
{
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" type="text/css">
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
    <p id="dialog" style="color:red">
        @TempData["notice"]<br />
        <button id="bclose">Ok</button>
    </p>
    <script language="javascript">
        $('#dialog').dialog({
          dialogClass: "no-close",
          buttons: [{
            text: "Ok",
            Click: function() {
              $('#dialog').dialog('close');
            }
          }]
        });
    </script>
}

DO I need to add any library for the above code 我需要为上面的代码添加任何库

Put your script section into: 将您的脚本部分放入:

$(document).ready(function(){
    //your script here
});

Something like this: 像这样的东西:

<script language="javascript">
   $(document).ready(function(){
     $('#dialog').dialog({
       dialogClass: "no-close",
       buttons: [{
         text: "Ok",
         click: function() {
           $('#dialog').dialog('close');
         }
       }]
     });
   });
</script>

Here is working jsfiddle 这是工作jsfiddle

暂无
暂无

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

相关问题 jquery-ui.js:8056 Uncaught TypeError: Cannot read property 'left' of undefined - jquery-ui.js:8056 Uncaught TypeError: Cannot read property 'left' of undefined jQuery错误“Uncaught TypeError:无法读取属性&#39;apply&#39;of undefined” - jQuery error “Uncaught TypeError: Cannot read property 'apply' of undefined” jQuery UI:未捕获的TypeError:无法读取未定义的属性&#39;nodeType&#39; - jQuery UI : Uncaught TypeError: Cannot read property 'nodeType' of undefined JQuery UI Slider Uncaught TypeError:无法读取未定义的属性“addClass” - JQuery UI Slider Uncaught TypeError: Cannot read property 'addClass' of undefined JS错误-未捕获的TypeError:无法读取未定义的属性“应用” ** - JS error - Uncaught TypeError: Cannot read property 'apply' of undefined** jQuery UI:未捕获的TypeError:无法读取未定义的属性“display” - jQuery UI: Uncaught TypeError: Cannot read property 'display' of undefined 无法动态加载jQuery UI-未捕获的TypeError:无法读取未定义的属性&#39;ui&#39; - Unable to load jQuery UI dynamically - Uncaught TypeError: Cannot read property 'ui' of undefined Uncaught TypeError:无法读取未定义的Google Maps的属性“ apply” - Uncaught TypeError: Cannot read property 'apply' of undefined Google Maps 未捕获的类型错误:无法使用 Sencha 读取未定义的属性“应用” - Uncaught TypeError: Cannot read property 'apply' of undefined with Sencha “Uncaught TypeError:无法读取属性&#39;apply&#39;of undefined”使用Bootstrap-Switch Jquery - “Uncaught TypeError: Cannot read property 'apply' of undefined” Using Bootstrap-Switch Jquery
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM