Can u help in this step?

Now you need to modify your display text. Change the innerText property of the text to be You enter the store.

function goStore() {
// document.getElementById(“text”).innerText = “You enter the store.”;
button1.innerText = “Buy 10 health (10 gold)”;
button2.innerText = “Buy weapon (30 gold)”;
button3.innerText = “Go to town square”;
button1.onclick = buyHealth;
button2.onclick = buyWeapon;
button3.onclick = goTown;
}

4 Likes

Hello, your second line is commented out, remove the forward slashes and run the code again.

1 Like

yeah, i done it but it didn,t work

1 Like

Ok, try to post the link to this exercise , just copy the url to the page so someone else can edit :slightly_smiling_face:

1 Like
1 Like

text is a variable, not an element you can select by Id, defined on line 12.

const text = document.querySelector("#text");

It will be similar to this:

button1.innerText = “Buy 10 health (10 gold)”;

4 Likes

function goStore() {
button1.innerText = “Buy 10 health (10 gold)”;
button2.innerText = “Buy weapon (30 gold)”;
button3.innerText = “Go to town square”;
button1.onclick = buyHealth;
button2.onclick = buyWeapon;
button3.onclick = goTown;
text.innerText = “You enter the store.”;
}

4 Likes

Use the “Ask for Help” button to open a new topic, thanks!

//Add this below the last onclick button from the previous exercise

Kindly throw more light on this cause I’m stuck here and need your help.

below is my code;

function goStore() {
  button1.innerText = "Buy 10 health (10 gold)";
  button2.innerText = "Buy weapon (30 gold)";
  button3.innerText = "Go to town square";
  button1.onclick = buyHealth;
  button2.onclick = buyWeapon;
  button3.onclick = goTown;
}
1 Like

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.