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
Note that when you make a selection you get the following error in the console:
Uncaught Error: Syntax error, unrecognized expression: :nth-of-type
That's because of this line:
$(".word-spaces tbody tr td:nth-of-type(" + indexes + ")").css('color', 'black');
Since a correct guess can set multiple indexes, you'll need to use a loop for the correct guesses like this:
$.each(indexes,function(e,i){
$(".word-spaces tbody tr td:nth-of-type(" + i + ")").css('color', 'black');
})
Additionally, I think this line is wrong:
$(".word-spaces > tbody > tr").append('' + word[i] + ' ')
You probably meant to use the value of i like this:
$(".word-spaces > tbody > tr").append('' + word[i] + ' ')
(though you dont really need the data-idx attribute at all since it will always be the same as the child index within the tr tag and you're using that to get the cells anyway)