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; };