Created
April 5, 2018 04:41
-
-
Save dave-martinez/ca7443fce4852668322b1ae07f5d0608 to your computer and use it in GitHub Desktop.
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) { | |
submitButton.disabled = false; | |
} else { | |
alert('Invalid number length'); | |
submitButton.disabled = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment