jquery.each inside jquery.each
im a noob, so forgive me...
i have an array, that holds the names of two other arrays that I want to check for a number match, and then return which array it is in..
-
var $backgroundType = ["grassArray", "sandArray"];
var $sandArray = ["0"];
var $grassArray = ["291", "281", "271", "261", "251", "241", "231", "221", "211", "201", "191", "181", "171", "161", "151", "141", "131", "121", "111", "101", "91", "81", "71", "61", "51", "41", "31", "21", "11","92", "102", "112", "122", "132", "142", "152", "162", "172", "182", "192", "202", "212","154","123", "133", "143", "153", "163", "173", "183"];
//-----------------------------------------------
function getBackgroundClass()
{
$bgType = "unknown";
jQuery.each($backgroundType, function()
{
var $currentBackgroundType = this;
jQuery.each($currentBackgroundType, function()
{
if(this == "202") //$clickID)
{$bgType = $currentBackgroundType;}
}
);
}
);
return $bgType;
}
right now, it should be returning "grassArray" but its not working..
yes I know theres a way to stuff multiple lists, inside an array.. i just dont know how to do it, much less how to check it, and return the right one.
if you can either tell me where i messed up, or tell me how to do the multiple array inside an array thing, and how to check it, that would be great, thanks...