A Pen by Dave Martinez on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateContact() { | |
// Baguhin mo lang onti to | |
var contact = document.getElementById('contact').value; | |
var contactLength = contact.length; | |
// Dagdag mo tong variable na to, regex tester | |
var contactIsDigit = /^\d+$/.test(contact); | |
// Tapos may last na condition | |
if((contactLength == 7 || contactLength == 11) && contactIsDigit) { |
OlderNewer