Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
You can’t perform that action at this time.