2014-11-22 63 views
0

我在jquery对话窗口中提交按钮。 Sumbit按钮有时不会触发。而且这个代码在同一个项目中的另一个webforms中工作正常。这使得完全疯狂。什么原因?谁能帮我?jquery对话框提交按钮有时不会触发

<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 = “假”

+0

首先,在jQuery 1.7的,所述.live()方法被弃用。第二件事代码中的表单标签在哪里? – Jinandra 2014-11-22 07:59:40

+0

@sanki我有表格标签。我裁剪了确切的对话窗口代码。我在另一个使用相同代码的webforms中使用jquery 1.7。它的工作很好。我找不到解决方案。我试过.clik()而不是.live()。但结果相同。感谢您的回复 – anilglpl 2014-11-22 08:06:32

回答

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; 
}); 
+0

@ sanki-仍然无法正常工作。我用libs/jquery/1.7.2/jquery.min.js替换了jquery/1.11.1。现在,即使Jquery对话窗口也不起作用。我只尝试.on()没有uisng jquery/1.11.1。但没用。感谢您的回复 – anilglpl 2014-11-22 08:24:22

+0

您的代码中使用了OnClick =“JobSeekerLogin_Click”吗?为什么?你是否试图通过点击按钮来执行一个功能? – Jinandra 2014-11-22 08:35:04

+0

@ sanki- Yes.Its登录表单(电子邮件,密码,提交按钮)。通过点击提交按钮,它连接到SQL服务器来检查凭据。 – anilglpl 2014-11-22 09:07:50

相关问题