I'm trying to find out the best way to check if an item is already in an array.
I have a number of checkboxes that belong to 1 of 5 groups. When a user clicks on one of these checkboxes, a second and third list that belong to one of the groups is written to the page.
What I'm trying to do is add these groups to an array, and once they're added, iterate through the array and add the second and third list.
var v = $(this).val();
// or this could be "something"
if ($.inArray(v, _catArray)) {
alert("it's here..");
} else {
alert("not in array");
}
No matter what, this tells me that it IS in the array... even though it's not at all.