0
How do I make a quiz game with textarea?
I tried this code, but it didnāt work: <p>Sample question? Say yes or no.</p> <textarea id=āwrite1ā placeholder=āwrite your answer hereā cols=ā15ā rows=ā1ā></textarea> <button onclick=āanswer()ā>Answer</button> <script> function answer(){ if (write1 == āyesā){ alert(āyou\āre correct!ā); } else{ alert(ānopeā) } } It always turned out as ānopeā even if I typed in yes. I need help
4 Answers
+ 1
Hi rac0208 ,
You're doing great!
It's wonderful to see you've been using the Code Playground too! :) Did you know you can post a link to your code in the discussion? Would you mind doing that for the code you put in your original post, plus any modifications you've tried? (Makes it a lot easier for us to help out when we're not in front of a desktop/laptop and working off the mobile app.)
In the meantime, this link might cover a bit more ground:
https://www.w3schools.com/jsref/dom_obj_textarea.asp
Looking forward,
-- Janning.
0
Hi rac0208 !
So that I'm not taking away from you the fun of learning, maybe ask yourself:
What does the script think "write1" is right now?
Am I doing a good job telling the script what "write1" is?
:)
0
So, Janning, Iām identifying write1 as the whole box, not the text i put inside it. I just donāt know how to do that...



