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
/******************************************************* | |
* setupPhoneFields | |
* Now let's rig up all the fields with the specified | |
* 'className' to work like phone number input fields | |
*******************************************************/ | |
function setupPhoneFields(className){ | |
var lstPhoneFields = document.getElementsByClassName(className); | |
for(var i=0; i < lstPhoneFields.length; i++){ | |
var input = lstPhoneFields[i]; | |
if(input.type.toLowerCase() == "text"){ | |
input.placeholder = "Enter a phone (XXX-XXX-XXXX)"; | |
input.addEventListener("keydown", onKeyDown); | |
input.addEventListener("keyup", onKeyUp); | |
} | |
} | |
} | |
//MAIN | |
setupPhoneFields("phoneNumber"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment