简体   繁体   English

jQuery UI:未捕获的TypeError:无法读取未定义的属性'nodeType'

[英]jQuery UI : Uncaught TypeError: Cannot read property 'nodeType' of undefined

I use jQUery UI Dialog: http://jqueryui.com/dialog/ (that i added manually to a preject web Forms .net) to display a description text on a web page. 我使用jQUery UI对话框: http : //jqueryui.com/dialog/ (我已将其手动添加到preject Web Forms .net中)在网页上显示描述文本。 This is my current code: 这是我当前的代码:

.aspx: 的.aspx:

<span id="bullAide" runat="server" class="glyphicon glyphicon-info-sign text-info" style="cursor: pointer;"></span>
<div id="dialog" runat="server" meta:resourcekey="TitreCourriel">
  <p id="txtDescription" runat="server"><%=GetLocalResourceObject("TexteCourriel.Text").ToString()%></p>
</div>

.js: .js文件:

$("[id$=dialog]").dialog({
    autoOpen: false,
    position: {
        of: $('#bullAide'),
    },
});
$("[id$=bullAide]").click(function (event) {
    setTimeout(function () { $("[id$=dialog]").dialog("open"); }, 1);
    var position = $(this).offset();
    $("[id$=dialog]").parent().css("left", position.left + 30);
    $("[id$=dialog]").parent().css("top", position.top - 30);
    setTimeout(function () { $("[id$=dialog]").parent().css("width", "auto"); }, 1);
});

Howerver, i have this error : Uncaught TypeError: 但是,我有此错误:Uncaught TypeError:

Cannot read property 'nodeType' of undefined
    at s (http://localhost/FIAF.PES.Particuliers/scripts/jquery-ui.min.js:6:11536)
    at jQuery.fn.init.t.fn.position (http://localhost/FIAF.PES.Particuliers/scripts/jquery-ui.min.js:6:13371)
    at t.(anonymous function).(anonymous function)._position (http://localhost/FIAF.PES.Particuliers/scripts/jquery-ui.min.js:11:7019)
    at t.(anonymous function).(anonymous function)._position (http://localhost/FIAF.PES.Particuliers/scripts/jquery-ui.min.js:6:4499)
    at t.(anonymous function).(anonymous function).open (http://localhost/FIAF.PES.Particuliers/scripts/jquery-ui.min.js:11:937)
    at t.(anonymous function).(anonymous function).open (http://localhost/FIAF.PES.Particuliers/scripts/jquery-ui.min.js:6:4499)
    at HTMLDivElement.<anonymous> (http://localhost/FIAF.PES.Particuliers/scripts/jquery-ui.min.js:6:5446)
    at Function.each (http://localhost/FIAF.PES.Particuliers/scripts/jquery-3.1.1.js:368:19)
    at jQuery.fn.init.each (http://localhost/FIAF.PES.Particuliers/scripts/jquery-3.1.1.js:157:17)
    at jQuery.fn.init.t.fn.(anonymous function) [as dialog] (http://localhost/FIAF.PES.Particuliers/scripts/jquery-ui.min.js:6:5329)

I really dont know what is wrong ! 我真的不知道怎么了!

Working Example: https://jsfiddle.net/Twisty/q0kebgwd/ 工作示例: https : //jsfiddle.net/Twisty/q0kebgwd/

HTML HTML

<p style="display: inline-block;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent arcu nisi, maximus eget lectus at, egestas pellentesque lectus. Donec varius tristique nunc eu dapibus. Phasellus urna massa, malesuada eu mi eget, vehicula cursus massa. Donec eu fringilla mi. Mauris leo tellus, vestibulum at ex sit amet, aliquam tincidunt lectus. Fusce blandit ex non sapien tempor fringilla. Donec leo ante, faucibus sed suscipit quis, bibendum convallis nulla. Suspendisse blandit dignissim ipsum. Suspendisse consectetur, quam sit amet placerat rhoncus, nisl nunc efficitur magna, ut rhoncus lectus felis ut velit.<span id="bullAide" class="glyphicon glyphicon-info-sign text-info" style="cursor: pointer; margin-left: 3px;"></span></p>
<div id="ContentPlaceHolder1_dialog" runat="server" meta:resourcekey="TitreCourriel">
  <p id="txtDescription" runat="server">This is a test</p>
</div>

JavaScript JavaScript的

$(function() {
  var $diag = $("[id$='dialog']")
  $diag.dialog({
    autoOpen: false,
    position: {
      my: "left top",
      at: "left+30 top-30",
      of: $("[id$='bullAide']")
    },
  });
  $("[id$='bullAide']").click(function(event) {
    $diag.dialog("open");
  });
});

This will help you position the dialog properly. 这将帮助您正确放置对话框。 The error may be a result of a missing parent or issues ascending the DOM in your code. 该错误可能是由于缺少父级或代码中的DOM升高引起的。 This stripped down code should work. 精简后的代码应该可以正常工作。 I also set the example to match your library versions. 我还设置了示例以匹配您的库版本。

暂无
暂无

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

相关问题 jQuery Uncaught TypeError:无法读取未定义的属性“nodeType” - jQuery Uncaught TypeError: Cannot read property 'nodeType' of undefined Javascript 说未捕获的类型错误:无法读取未定义的属性“nodeType” - Javascript say Uncaught TypeError: Cannot read property 'nodeType' of undefined 未捕获的TypeError:无法读取null的属性“ nodeType” - Uncaught TypeError: Cannot read property 'nodeType' of null JQuery UI Slider Uncaught TypeError:无法读取未定义的属性“addClass” - JQuery UI Slider Uncaught TypeError: Cannot read property 'addClass' 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 未捕获(承诺)TypeError:无法读取未定义的属性“ ui5” - Uncaught (in promise) TypeError: Cannot read property 'ui5' of undefined Kendo ui:未捕获的类型错误:无法读取未定义的属性“toLowerCase” - Kendo ui: Uncaught TypeError: Cannot read property 'toLowerCase' of undefined jquery-ui.js:12443未捕获的TypeError:无法读取undefined的属性&#39;apply&#39; - jquery-ui.js:12443 Uncaught TypeError: Cannot read property 'apply' of undefined jquery-ui.js:8056 Uncaught TypeError: Cannot read property 'left' of undefined - jquery-ui.js:8056 Uncaught TypeError: Cannot read property 'left' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM