Ask coding questions

← Back to all posts
Advice needed
FallenAngel6

So I've been trying to make an HTML game and I'm running into some trouble. First, the timer isn't working. And second, the text field shows previously entered values. Is there a way I can change these two things? Thanks 🤗!

P.S. Does anyone have any ideas for the colour scheme and CSS?

Answered by CSharpIsGud [earned 5 cycles]
View Answer
Voters
FallenAngel6
Comments
hotnewtop
CSharpIsGud

Add autocomplete="off" to the text input element.
Also on line 43 you have a = instead of ==.
And remove 'previous' from line 26.

FallenAngel6
TheDNAHero

The reason the input field isn’t reloading is because of the fact that you don’t clear it after enter, so I would do document.getElementById(“inputnamehere”).value=“”

MrVoo

You need curly brackets for your if statements

FallenAngel6

@MrVoo Oh really? I'm a little used to C++ code...

CSharpIsGud

@MrVoo @FallenAngel6 You do not, JS like C supports omitting brackets for single statement if's

MrVoo

@CSharpIsGud Whoops, I guess my internet died when I tested it... anyway, @FallenAngel6 I think your problem is on like 41. Change it to setInterval(() => {

CSharpIsGud

@MrVoo its the same thing, but it does look better

MrVoo

@CSharpIsGud Whoops x2, your answer looks right