Currently, as I am in the process of creating a small typewriter application, I have encountered an issue with determining if the button pressed matches the value of specific span elements.
To provide further context, there are two divs each containing spans with different letter values. These spans are stored in variables named leftPartSpans and rightPartSpans. My approach involves iterating through each item using a loop to check if any of the characters match the key code:
for (i=0; i<leftPartSpans.length; i++) {
if(pressedKey == leftPartSpans[i].nodeValue) {
leftPart.style.webkitTransform = "rotateZ(20deg)";
}
}
Unfortunately, this method seems to fall short of achieving the desired outcome. For more details, you can view the entire project at http://codepen.io/gbnikolov/pen/wJHhk
Thank you in advance, Georgi