Introduction
I have seen this question so many times on forums, so decided to put it as tip. Here is a simple code snippet to get a unique list of values out of a JavaScript array. It makes use of jQuery to do a look up.
Using the code
function GetUnique(inputArray)
{
var outputArray = [];
for (var i = 0; i < inputArray.length; i++)
{
if ((jQuery.inArray(inputArray[i], outputArray)) == -1)
{
outputArray.push(inputArray[i]);
}
}
return outputArray;
}