jquery - Get array value from variable -


I want to get the value of an array based on the indicator of the UL element. I try to convince myself:

  var descgal0 = ["3456", "463", "6557", "5242"]; Var descgal1 = ["gfdgfd" "gfgdfg", "gfdg", "gfdg"]; $ ("# Gal-content-all section ul li img") Click (function () {var index = $ (this) .Parent (). Index (); var indexul = $ (this) .Parent () parent (). Parent (). Index ();} );  

The problem is

  $ ("# gal-zoom h4"). Text (descgal0 [index]); // Works! $ ("# -Jul-zoom H4") Text ("digal" + index + [index]); // does not work: ( 

Depending on the Ul how can I get the array [LE] value ... ?? Thank you !!!!

< Div class = "post-text" itemprop = "text">

You can use array array since sequential indexing

  var descgals = [["3456" Click ("463", "6557", "5242"], ["gfdgfd", "gfgdfg", "gfdg", "gfdg"]] $ ("#Gall-content-all section ul Li img") (function () {Var index = $ (this) .Parent () Index (); var indexul = $ (this) .Parent () .Parent (). Index (); $ ("#Gal-Zoom H4 "). Text (descgals [indexul] [index]);});  

Comments