How do you implement such a calculator?

Let's have an input with type="chekbox", you need to make it so that when you mark the checkbox to the initial number(e.g. 0) was added the desired number(e.g. 3000)
March 20th 20 at 11:42
2 answers
March 20th 20 at 11:44
Solution
Checkbox: <input type="checkbox" id="myCheck" onclick="myFunction()">
Text: <input type="text" id="text" vlaue="358">

function myFunction() {

 var checkBox = document.getElementById("myCheck");

 var text = document.getElementById("text");


 if (checkBox.checked == true){
 text.value = Number(text.value) + 300
 } else {
 //When removing a tick you will spend 300
text.value = Number(text.value) - 300;
}
}
the vehicle tags in the CSS!
be so kind to make and css styles
............
))) - erick_Lind commented on March 20th 20 at 11:47
March 20th 20 at 11:46
How do you implement such a calculator?

using javascript (I checked just in case - with javascript)

Find more questions by tags CSSJavaScriptHTML