我的Default.aspx頁面上有許多文本框,類似於下面的內容。在單個ASP文本框中驗證jquery
<asp:TextBox ID="myTextbox" runat="server"></asp:TextBox>
當用戶點擊該按鈕提交,下面的JavaScript執行:
$(function() {
$('#<%= myButton.ClientID %>').click(function (clickToExecuteMyMethod) {
var userWantsToSubmit = window.confirm("Are you sure you want to press the button?");
if (userWantsToSubmit) {
$.blockUI({ overlayCSS: { backgroundColor: '#00f' }, message: '<h1>Please wait a while...</h1>' });
}
if (!userWantsToSubmit) {
clickToExecuteMyMethod.preventDefault();
}
});
});
但我還想要使用jQuery驗證的東西(什麼)已被輸入到myTextbox一旦按下相同的按鈕。如果它驗證成功,那麼我想要另一個JavaScript來觸發。
我會嘗試實施了jQuery驗證插件。不過,我現在能夠獲得此代碼的工作。 – Krondorian