0
How do I get my clear button to work
I am trying to use the button tag to clear my text and p tag. But it seems not doing anything https://code.sololearn.com/Wp4525OEqABE/?ref=app
18 Respuestas
0
just call the compare function from inside of the randnum function. In other words, add to line 14:
compare();
+ 1
I didn't see where to add my code snippet so y'all know what I'm talking about.
+ 1
clear button is working fine for me, might be an app issue on your end
compare isn't doing anything, though, cause you only call it once when the page loads
+ 1
as I said, you're only calling it once, at window.onload, so it runs once when the page loads (before the user has a chance to input anything) and then you just never call it. add a compare() call to the end of randnum or something
+ 1
oh, also having tried that: you shouldn't ask for arguments for compare(), and the else if can just be an else
+ 1
kingSab
There is no input type="string".
if you want numbers, use type ="number"
Since you are only guessing a few numbers, my suggestion is to use buttons instead of input. It is easier to use and the game would be more fun to play.
Also, changing the number everytime makes it harder to win. Maybe a higher or lower hint is given and the player gets multiple tries would be better?
If the player constantly loses, it is very easy to lose interest in the game.
0
Yes I got it fixed. Now it's the compare code. Can you elaborately make me understand where I'm wrong here.
0
0
Orin Cook when you say add compare to random, is it as an argument or what? I am struggling to understand that.
0
Orin Cook thanks a lot. It worked. Will add some other functionalities and maybe little CSS.
Is there any social media acct that I can follow you?
0
Hello Bob_Li , thanks for the suggestions, everything is working just fine now. I just need to figure out how to give the player 3 chances, break to loop if he guess it right
0
kingSab
you could add a try counter.
0
Bob_Li yes I'm working on that
0
Pls i need help
0
Israel Akpan where do you need help? Share you problem and code on your question tab and someone will help you.
0
What is input or c
0
How can I get curve corner in my button?
0
Raj Grover what is curve corners? ...this {}?