Quite new to Javascript, I have a small problem I cant seem to solve.
The idea is, when I press my “calculate” button, it will do calculations that I have set down in my function. The values are taken from input text box. The initial value is set to for example “4”, when I change the values in my text box, I want my function to keep using those new values which I have in my textbox. When hitting the calculate button, it will always use the new value.
function calculations(){
document.getElementById(“inputtextbox”).value = “4”; //input box, initial value 4
if (inputtextbox !== 4) {
var value = Number(document.getElementById(“inputtextbox”).value); //new values to be used
}
//using the “value” variable to do some maths down the line
}
Yes, the initial value is set to 4.
I guess my logic is trying to be, if my value I type in the inputtextbox is not 4, it will then use this newly typed value in our variable named value