Created
May 29, 2015 17:54
-
-
Save g5codyswartz/766bec2a3fb4abd81b5b to your computer and use it in GitHub Desktop.
Add Location Input Length Checker
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
var longInputTextLengths = 0; | |
var inputTextFields = $('input[type=text]'); | |
var inputTextFieldsCount = inputTextFields.length; | |
$(inputTextFields).each(function() { | |
if($(this).val().length > 155) { | |
console.log(this); | |
console.log('^ Above element character length: '+$(this).val().length); | |
longInputTextLengths++; | |
} | |
inputTextFieldsCount--; // count down our elements we're iterating through | |
// Check for last loop and if we found any inputs over our threshold | |
if (inputTextFieldsCount === 0 && longInputTextLengths > 0) | |
alert('Found '+longInputTextLengths+' text inputs that were over 155 characters in length. Check the Console for more information.'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment