K
K
Koreetz Koreetz2018-03-06 16:00:57
JavaScript
Koreetz Koreetz, 2018-03-06 16:00:57

The program for calculating money went into a stupor?

Good afternoon, I just started learning js - tell me how to finish the program. In appearance, the idea is simple, but I don’t understand how to complete it: the user entered a number in the field / the program saved it / then, when another number was entered, a new one was added to the saved value, and so on .....
https://codepen.io/shnopik87/pen /XZLOmp
Thank you)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
evg_96, 2018-03-06
@shnopik87

const result = document.querySelector(".money-block__value");
const field = document.querySelector(".field");

document.querySelector(".btn").addEventListener("click", () => {
  result.textContent = (+result.textContent + +field.value);
});

C
cicatrix, 2018-03-06
@cicatrix

Your "saved" number is not saved at all.
I redid:
https://codepen.io/anon/pen/wyLOKz?editors=1111

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question