So I'm trying to input an array into a jquery selector and for some reason I can't get it to work at all. I've tried a few approaches below 1st:
var id = ["#id1", "#id2", "#id3"];
$(id[0]).css('color', '#000');
my other attempt:
var id = [];
for(var x = 0;x < 3; x++){
id[x] = x;
$("#id"+id[0]).css('color', '#000');
}
So I'm wondering what might be the approach to solving this?
example of what I'm using this for:
for(var x = 0;x < 28; x++){
function randomizerlet(){
randlet[x] = Math.floor(Math.random()*156);
timesletrun[x] += 1;
if (masterlet[randlet[x]] == letter[x]){
$('#flipL4_1').css('background-position', masterlet[randlet[x]]);
clearInterval(intervallet[x]);
}
else{
if(timesletrun[x] == 300){
masterlet[randlet[x]] = letter[x];
$('#flipL4_1').css('background-position', masterlet[randlet[x]]);
clearInterval(intervallet[x]);
}
else{
$('#flipL4_1').css('background-position', masterlet[randlet[x]]);
}}
}
var intervallet[x] = setInterval(function() {
randomizerlet();}, 10);
}
function randomizerlet[x](){even run?