Page 1 of 1

How to make a multidimensional array with jQuery?

Posted: Fri Nov 19, 2010 4:29 pm
by marcelcolt
To get to the chase,i have a sort of lightbox-app and i need to make a multidimensional array.

This is what i got sofar:

Code: Select all

var imageNum = 0;
var linkArray= new Array;
var imageArray = new Array;

linkArray = jQuery('' + imageLink.tagName + '[rel=' + imageLink.rel + ']').get();
     imageArray = jQuery.each(linkArray, function(anchor){ return [anchor.href, anchor.title]; });
     
     alert(imageArray[imageNum][0]);
     
     //loop through all anchors with the same 'rel'
           while (imageArray[imageNum] != imageLink.href) { imageNum++; }
The 'imageLink'-variable is an anchor- or area-tag clicked on.

Why do i still keep getting 'undefined' in the alert-window (there for test-reasons only)?



Anyone knows how to help?