php - Jquery 模态表单在 PHP 中不适用于我

标签 php javascript jquery

最近我开始使用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>

如果我有任何错误,请纠正我。谢谢大家。

最佳答案

您需要包括:

modal: true,

在您的对话框定义中,如下所示:

var $dialog = $('<div></div>')
    .html('This dialog will show every time!')
    .dialog({
        autoOpen: false,
        modal: true,
        title: 'Basic Dialog'
    });

关于php - Jquery 模态表单在 PHP 中不适用于我,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6979056/

相关文章:

javascript - 使用 JavaScript 进行 RelaxNG 或 XSD 模式验证

javascript - 如何在 React-navigation/react-native 中隐藏后退按钮

php - Laravel - 在多对多关系中渴望加载单个项目

javascript - 如何使用 jSignature.js 在一个页面中显示多个签名?

php - Redis - 使用 predis 检查键是否存在

Javascript:如何在循环中使用正则表达式

javascript - jQuery UI 不会隐藏元素

javascript - 突出显示滚动上的当前部分 - 部分之间的间隙

javascript - ASP.NET MVC 接收 "null"作为字符串而不是 null

php - 如何搁置新发布的记录?