Articles → Jquery → Form Validation In Jquery
Form Validation In Jquery
Forgot Password Screen
Click to Enlarge
$(document).ready(function() {});
$(document).ready(function() {
$("#<%= btnRetrievePassword.ClientID %>").click(function() {});
});
jQuery.trim(<textbox_text>.length
$(document).ready(function() {
$("#<%= btnRetrievePassword.ClientID %>").click(function() {
var emailText = $("#<%= txtEmailID.ClientID %>").val();
if(jQuery.trim(emailText).length == 0) {
// Write a logic to handle it
}
});
});
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
$("#<%= btnRetrievePassword.ClientID %>").click(function() {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
var emailText = $("#<%= txtEmailID.ClientID %>").val();
if(jQuery.trim(emailText).length == 0) {
// Write a logic to handle it
} else if(!emailReg.test(emailText)) {
// Write a logic to handle it
}
});
Summary