2014-11-22 46 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

相關問題