J'ai un tableau comme celui-ci:question jQuery sur la boucle à travers un réseau
var gridArray = [ 1,2,0,1,2,3,2,1,2,3,4,4,3,2,2,2,0 ]
Et je voudrais une fonction jQuery each()
comme ceci:
$('li.node').each(function() {
loop through the array
var rndTile = the current array digit
$(this).css({ 'background-image': 'url(images/'+arrayDigit+'.jpg' });
});
Comment pourrais-je mettre en œuvre ce?
ne pas boucler sur un tableau avec 'for..in' ou' .each() '! – jAndy