How to make a multidimensional array with jQuery?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
marcelcolt
Forum Newbie
Posts: 22
Joined: Tue Mar 02, 2010 5:56 am

How to make a multidimensional array with jQuery?

Post 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?
Post Reply