representing a character at various array in an html table w/JQuery/JavaScript

后端 未结 3 821
青春惊慌失措
青春惊慌失措 2021-01-23 18:27

I\'ve run into some issue graphically representing some of my data via J Query in my Hangman game- right now I\'m working on the last part of my play(space) function to take int

3条回答
  •  天涯浪人
    2021-01-23 19:10

    I figured this out on my own (I sort of panicked) like this: first I created a .forEach loop to loop through the word, then the issue was the difference btwn array concatenation in JS & html/css... I creates the index variable, and added one & also an additional plus sign outside of the parenthesis... So, this solves the problem:

    indexes.forEach(function(index) { $(".word-spaces tbody tr td:nth-of-type(" + (index + 1) + ")").css('color', 'black'); });

提交回复
热议问题