Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery UI对话框(版本1.10.4)仅打开一次_Jquery_Jquery Ui_Dialog_Jquery Ui Dialog - Fatal编程技术网

jQuery UI对话框(版本1.10.4)仅打开一次

jQuery UI对话框(版本1.10.4)仅打开一次,jquery,jquery-ui,dialog,jquery-ui-dialog,Jquery,Jquery Ui,Dialog,Jquery Ui Dialog,我正在我的网页中实现jQueryUI(版本1.10.4),这里有一个非常简单的代码。问题是,我不知道为什么它只打开一次。有人能发光吗 主代码: <button class="subscribe">Subscribe</button> <div id="login-form" title="Sign In"> <p class="validateTips">All form fields a

我正在我的网页中实现jQueryUI(版本1.10.4),这里有一个非常简单的代码。问题是,我不知道为什么它只打开一次。有人能发光吗

主代码:

<button class="subscribe">Subscribe</button>

    <div id="login-form" title="Sign In"> 
                        <p class="validateTips">All form fields are required.</p>
                        <form>
                        <fieldset>
                            <label for="username">Username</label>
                            <input type="text" name="username" id="username" class="text ui-widget-content ui-corner-all" />
                            <label for="password">Password</label>
                            <input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" />
                        </fieldset>
                        </form>
                    </div>
$(document).ready(function () {
    $( "#login-form" ).dialog({
            autoOpen: false,
            height: 300,
            width: 350,
            modal: true,
            buttons: {
                "Login": function() {
                    //php code

                 },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            },
            close: function() {
                allFields.val( "" ).removeClass( "ui-state-error" );
            }
            });


            $(".subscribe").button().click(function() {
                $("#login-form").dialog("open");
            });
});

这是因为
allFields
没有定义。它抛出了一个错误。用这句话:

allFields.val( "" ).removeClass( "ui-state-error" );
评论说,它工作得很好

小提琴:


我添加了
$('input').val(“”).removeClass(“ui状态错误”)
to the fiddle清除字段而不抛出错误。

您不能直接将JavaScript(它也意味着jQuery等)与php结合。@Václav Ya我知道,对于这一部分,我将重定向到php页面。但现在主要的问题是弹出窗口只显示一次。我查看了我使用对话框的代码。我的对话框(带有列表)每次都会打开,但我不使用模式版本。我猜它是在模态对话框中。