Hello , i have the following script and i can't find out how to use the value inside car[0]['img'] inside this $('#img2').attr('src',car[0]['img']); im a JS noob so please explain me .. why jquery wont accept the 2d array as string value and run the function , and whats the possible solution of my problem ?
var id = 0 ;
var car = new Array();
car[0]['img'] = "./images/carousel_img_2.jpg";
car[0]['title'] ="title";
car[0]['desc'] = 'longer description goes here';
car[0]['link'] = "http://goeshere.com";
car[1]['img'] = "./images/carousel_img_3.jpg";
car[1]['title'] ='title';
car[1]['desc'] = 'longer description goes here';
car[1]['link'] = "http://goeshere.com";
car[2]['img'] = "./images/carousel_img_2.jpg";
car[2]['title'] ='title';
car[2]['desc'] = 'longer description goes here';
car[2]['link'] = "http://goeshere.com";
function nxt () {
$('#img2').fadeOut('slow', function(){
var img = car[i]['img'] ;
$('#img2').attr('src',img);
});
$('#img2').fadeIn('slow');
}