Tag archive

validation

Related writing grouped under this topic, ready for internal linking and search discovery.

5 articlesTopic cluster: #validation

General

validate email id using jquery or javascript

function validateEmail(email) { var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,6})?$/; return emailReg.test(email); } Usage:- if(validateEmail(emailString)){ alert(‘Your email is valid’); } else{ alert(‘Your email is not valid! There should be atleast @ and one dot(.) present in it’); }

May 4, 2018

Read article

HTML

Validate date format mm/dd/yyyy in jquery or javascript

<script type=”text/javascript”> function isValideDate(datavalue){ var regexValidDate = /^(?:(0[1-9]|1[012])[\/.](0[1-9]|[12][0-9]|3[01])[\/.](19|20)[0-9]{2})$/; return regexValidDate.test(datavalue); } var dateToCheck = ’06/01/2011′, if(isValideDate(dateToCheck)){ alert(“Given date is valid as per the format of MM/dd/Y

Mar 8, 2018

Read article

HTML

validate mobile number on keypress using jquery

How to validate and restrict unwanted character for mobile or phone number field using jquery $(document).ready(function () { $(‘#mobile’).keyup(function () { var $th = $(this); $th.val($th.val().replace(/[^0-9]/g, function (str) { return ”; })); }); });

Aug 8, 2015

Read article

javascript

validate name on keypress using jquery

How to validate and restrict unwanted character for name field using jquery $(document).ready(function () { $(‘#name’).keyup(function () { var $th = $(this); $th.val($th.val().replace(/[^a-zA-Z0-9 \`]/g, function (str) { return ”; })); }); });

Aug 8, 2015

Read article