I have an array:
let ids = ["d0","d1","d2","d3","d4","d5","m0","m1","m2","m3","m4","m5"];
I have a bunch of html elements with the same id’s
<button id="d0" onclick="showMe(this);"> //etc etc... all the way to m5
I compare them with
function showMe(element){
var whoWasClicked = element;
let ids = ["d0","d1","d2","d3","d4","d5","m0","m1","m2","m3","m4","m5"];
for (let i = 0; i < ids.length; i++) {
if (whoWasClicked.id != document.querySelector(ids[i])) {
//document.querySelector(ids[0]).style.border = "none";
console.log(ids[i] + " : " + whoWasClicked.id);
}
}
}
I then get the following output:
d0 : d1
d1 : d1
d2 : d1
d3 : d1
d4 : d1
d5 : d1
m0 : d1
m1 : d1
m2 : d1
m3 : d1
m4 : d1
m5 : d1
They are both of type “string”, so how is it possible to see
d1 : d1
as an output? shouldnt d1 not be shown and all the others be shown?