To check if an array contains a value in Javascript you can use the snippet below.
Sample Javascript
Array.prototype.inArray = function (inputValue) {
var counter;
for (counter=0; counter < this.length; counter++) {
if (this[counter] === inputValue) {
return true;
}
}
return false;
};
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php
How to check if an array contains a value in #Javascript http://t.co/e8qDJ0crkc #js #jquery #html #html5 #cs #php
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php
RT @CodeSnippetsNET: How to check if an array contains a value in #Javascript http://t.co/3CDK5MhYpC #js #jquery #html #html5 #cs #php