在下面的代码中,单击按钮时不会打开对话框。此外,对话框的内容会在页面加载时显示,并且在我单击按钮之前不会隐藏。
出了什么问题?
此代码与 jquery ui 站点的代码非常接近。
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="../websites/jquery-1.10.1.min.js"></script>
<title>Untitled Document</title>
</head>
<body>
<button id="opener">open the dialog</button>
<div id="dialog" title="Dialog Title">I'm a dialog</div>
<script>
$( "#dialog" ).dialog({ autoOpen: false });
$( "#opener" ).click(function() {
$( "#dialog" ).dialog( "open" );
});
</script>
</body>
</html>