Jquery Dialog提交按钮有时不会触发

时间:2014-11-22 07:46:53

标签: jquery asp.net visual-studio-2012

我在jquery对话框窗口中提交了按钮。 Sumbit按钮有时不会触发。同一段代码在同一个项目中的另一个webforms中工作正常。这让我很生气。这是什么原因?有谁可以帮助我?

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
    <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css" rel="stylesheet" type="text/css" />
    <script src="http://localhost:6708/Scripts/jquery-ui-1.11.2.js"></script>
    <script src="http://localhost:6708/Scripts/IndexLogin.js"></script>

                <asp:LinkButton ID="JobSeekerLogin" Text="JOB SEEKER LOGIN" runat="server" OnClick="JobSeekerLogin_Click"></asp:LinkButton>
                <div id="login-content">
                    <table>
                        <tr>
                            <td>
                                <asp:TextBox ID="TexEmail" placeholder="Enter Your Email Id" runat="server" required="required" TextMode="Email"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:TextBox ID="TexPassword" placeholder="Password" runat="server" TextMode="Password" required="required"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:CheckBox ID="CheJobSeekerRemember" runat="server" Text="Remember Password" Checked="true"></asp:CheckBox></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Button ID="btnJobSeekerLogin" runat="server" Text="Job Seeker Login" OnClick="btnJobSeekerLogin_Click" />
                            </td>
                            <td>
                                <asp:LinkButton ID="forgotPassword" Text="FORGOT PASSWORD?" runat="server"></asp:LinkButton>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:LinkButton ID="JobSeekerRegistrationPopup" Text="Are You New User?Register Here" runat="server"></asp:LinkButton>
                            </td>
                        </tr>
                    </table>
                </div>

我试过了

    $(document).ready(function () {

    $("[id*=JobSeekerLogin]").live("click", function () {
        $("#login-content").dialog({
            open: function(type,data) {
                $(this).parent().appendTo("form");
            },
            title: "JOB SEEKER LOGIN",
            width: 600,
            modal: true,
        });
        return false;
    });
});


$(this).parent().appendTo(jQuery("form:first"));


$(this).parent().appendTo(jQuery("form"));

注意:不使用 UseSubmitBehavior =“false”

1 个答案:

答案 0 :(得分:0)

尝试以下更改:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

$("[id*=JobSeekerLogin]").on("click", function () {
    $("#login-content").dialog({
        open: function(type,data) {
            $(this).parent().appendTo("form");
        },
        title: "JOB SEEKER LOGIN",
        width: 600,
        modal: true,
    });
    return false;
});