How to enable a disenable button?

I am making a clicker game.I want to know how to make a a manager button. i Want to have the points be at level 10(so 10 clicks) and then your allowed to press this other button which will cost 10 points. But in doing so the button that you press to increase the number , is being continuously pressed.

Your point is not crystal clear… Showing code would help a lot.

.

i Want to have the points be at level 10(so 10 clicks)

Which button ? Manager button ?

.

allowed to press this other button

what is this other button ?

.

the button that you press to increase the number , is being continuously pressed.

which button ? Manager, other ?

But your question is

How to enable a disable button?

You can add a .disabled modifier

 .disabled(numberOfPress)   

**To create a manager button in your clicker game that requires 10 points to be pressed, you can follow these steps: ** Define a variable to keep track of the player's points. Let's call it points and initialize it to 0.

Create a button element in your game's interface, which will serve as the clicker button. This button will increment the points variable each time it is clicked.

Add an event listener to the clicker button, so that whenever it is clicked, it increases the points value by 1 and checks if the player has reached level 10.

When the player reaches level 10 (i.e., points reaches 10), enable the manager button by removing the disabled attribute or changing its appearance to indicate that it can now be pressed.

Create another button element for the manager button. Initially, disable or visually indicate that it is not clickable until the player reaches level 10.

Add an event listener to the manager button, which subtracts 10 points from the points variable and performs the desired action, such as increasing the clicker's auto-click rate or providing some other bonus.

Here's an example implementation in JavaScript: // Step 1: Initialize points let points = 0;

// Step 2: Create the clicker button const clickerButton = document.getElementById('clickerButton');

// Step 3: Add event listener to clicker button clickerButton.addEventListener('click', () => { points++; // Increment points by 1 if (points === 10) { managerButton.disabled = false; // Enable the manager button } });

// Step 5: Create the manager button const managerButton = document.getElementById('managerButton'); managerButton.disabled = true; // Disable the manager button initially

// Step 6: Add event listener to manager button managerButton.addEventListener('click', () => { points -= 10; // Subtract 10 points // Perform the desired action });

Remember to replace 'clickerButton' and 'managerButton' with the actual IDs of your clicker and manager buttons in your HTML code.

With this implementation, the clicker button will only become active after the player accumulates 10 points. Once the manager button is pressed, it will subtract 10 points from the player's total and trigger the desired action.

How to enable a disenable button?
 
 
Q