最近我开始使用jquery,当尝试使用jquery弹出模态表单时它不适用于我,css文件和javascript文件保持在本地。请参阅下面的代码段
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var $dialog = $('<div></div>')
.html('This dialog will show every time!')
.dialog({
autoOpen: false,
title: 'Basic Dialog'
});
$('#opener').click(function() {
alert('test');
$dialog.dialog('open');
// prevent the default action, e.g., following a link
return false;
});
});
</script>
</head>
<body>
<?php
echo '<link rel="stylesheet" type="text/css" href="jquery-ui.css">';
?>
<button id="opener">Open the dialog</button>
</body>
如果我有任何错误,请纠正我。谢谢大家。
答案 0 :(得分:0)
您需要包含:
modal: true,
在对话框定义中,如下所示:
var $dialog = $('<div></div>')
.html('This dialog will show every time!')
.dialog({
autoOpen: false,
modal: true,
title: 'Basic Dialog'
});