Home > Mobile >  how to disable button when it reaches 20 clicks, how to reset the input after every click
how to disable button when it reaches 20 clicks, how to reset the input after every click

Time:01-01

I am new at JS, I work on a game from a tutorial and I want to add these 2 things. The game is guess the number game. I would like the Input to reset after every click on the button so the user won't have to delete the number manually. The game gives you 20 tries. when you reach 20 I would like the button to be disabled and the scrore field to be at 0. I looked on suggestions online but nothing worked for me.

html:

<header>
      <h1>Guess My Number!</h1>
      <p >(Between 1 and 20)</p>
      <button >Again!</button>
      <div >?</div>
</header>
<main>
      <section >
        <input type="number"  />
        <button >Check!</button>
      </section>
      <section >
        <p >Start guessing...</p>
        <p >           
  • Related