Ask coding questions

← Back to all posts
Add more items
WilliamXing (51)

How do I add more items to the shop?

Answered by InvisibleOne (2978) [earned 5 cycles]
View Answer
InvisibleOne (2978)

I would assume you just make another div under your bomb one

<div id ='another' class='banner'>
  <h3>Another Thing</h3>
  <p>Bla bla bla bla</p>
  <p>Cost: 1000</p>
  <p>Return: 10 cps</p>

then in the javascript

const ANOTHER = document.getElementById('another')

ANOTHER.addEventListener('click', incrementAnother);

function incrementBomb() {
  if (cookies >= 1000) {
    cookies -= 1000;
    another ++;
  } else {
    alert("Not enough cookies!")