Last active
February 1, 2017 10:19
-
-
Save jonperron/46b6ce41374dd6eb1f753fe6cf8ed598 to your computer and use it in GitHub Desktop.
Check if field content is in an array.
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
<script type="text/javascript"> | |
var contentArray = [ | |
... | |
]; | |
var testField = document.getElementById('test_field'); | |
testField.onkeyup = function(){ | |
if(contentArray.indexOf(testField.value) != -1) { | |
alert("It's in the array !"); | |
} else { | |
alert("It's not in the array !"); | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment