我无法打开对话框

时间:2019-07-17 13:11:20

标签: javascript html asp.net

这是javascript代码:

$(function () {
  $( "#dialog1" ).dialog({
    autoOpen: false
  });

  $("#opener").click(function() {
    $("#dialog1").dialog('open');
  });
});

这是我的HTML代码: <button id="opener">open the dialog</button> <div id="dialog1" title="Dialog Title" hidden="hidden">I'm a dialog</div>

1 个答案:

答案 0 :(得分:0)

您的代码工作-

$(function() {
  $("#dialog1").dialog({
    autoOpen: false
  });

  $("#opener").click(function() {
    $("#dialog1").dialog('open');
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<button id="opener">open the dialog</button>
<div id="dialog1" title="Dialog Title" hidden="hidden">I'm a dialog</div>