I will just write a little code that should change CSS X ids.
I have 3 identifiers in HTML objects (each element has 1 class) =
element 1 id = "p1" class = "test1"
element 2 id = "p2" class = "test1"
element 3 id = "p3" class = "test1"
i create two arrays:
var statArray = ["p1","p3"];
var array = ["p1","p3"];
than I check if Array 1 = Array 2
for (var ix = 0; ix < array.length; ix++) {
if (array[ix] === statArray[ix])
Now I will change the css (background-color) identifiers.
How can I change identifiers, where id = array [ix]?
my attempt:
$(".test1").attr(array[ix]).css("background-color","#ff0000");
source
share