+ 5

What's the problem?

https://code.sololearn.com/WlF1pR0Y75gd/?ref=app Run the code, (wait) click “Start game” btn, write “#Elements” in the input field, which is same as the text in the h2 written above, even after both the texts are same, the alert is saying wrong. See JS line 33.

23rd Dec 2021, 5:02 AM
Parth
Parth - avatar
3 Respostas
+ 4
In this function "checkAns()" you put H2 the correct is H1 var h1 = $(".game h1").text(); if (input == h1) alert("Correct!"); else alert("Wrong!");
23rd Dec 2021, 8:35 AM
SoloProg
SoloProg - avatar
23rd Dec 2021, 8:11 AM
Parth
Parth - avatar
+ 1
There is no mistake by just change the way you call the function. instead of this: function startGame() { use this: startGame = () => { instead of this: function checkInputLength() { use this: checkInputLength = () => {
23rd Dec 2021, 5:34 AM
SoloProg
SoloProg - avatar