Javascript validation for input fields, email, phone number and alphanumeric

// check to see if input is whitespace only or empty function isEmpty(str) { return (!str || 0 === str.length); } function isBlank(str) { return (!str || /^\s*jQuery/.test(str)); } // check to see if input is a valid email address function isEmail(str) { var regexEmail = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{1,4}$/; return (regexEmail.test(str)); } // check to see if… Continue reading Javascript validation for input fields, email, phone number and alphanumeric

Live digital timer using Jquery

function updateClock() { var currentTime = new Date(); var currentHours = currentTime.getHours(); var currentMinutes = currentTime.getMinutes(); var currentSeconds = currentTime.getSeconds(); currentMinutes = (currentMinutes < 10 ? ‘0’ : ”) + currentMinutes; currentSeconds = (currentSeconds < 10 ? ‘0’ : ”) + currentSeconds; var timeOfDay = (currentHours < 12) ? ‘AM’ : ‘PM’; currentHours = (currentHours… Continue reading Live digital timer using Jquery