I have several divs...
<div id="foo"></div>
<div id="bar"></div>
And each has an associated jQuery array. Eg.
var foo_array = ["One", "Two", "Three"];
var bar_array = ["Four", "Five", "Six"];
I want to alert the first value in the related array when I click on the div.
So something like:
$(div).on("click",function(){
$divid = $(this).attr("id");
$firstval = ????_array[0];
alert($firstval);
})
-- where instead of ???? I dynamically echo out the value of $divid. Easy in PHP, but I'm stumped how to do this in javascript?