Why can't you always get the values of these two input?

: <textarea id="dotinput" style="width:200px;height:200px;"></textarea>
<br/>
: <input type="text" id="spreadrateinput" />
: <input type="text" id="spreaddegreeinput" />
<input type="button" value="" onclick="fun()" />
        
        
var inkmax = document.getElementById("spreadrateinput");
var times = document.getElementById("spreaddegreeinput");
console.log(inkmax.value);
console.log(times.value);
Mar.09,2021

1 : javascript is triggered, and consloe statements are not executed when you enter data;
2 : you can use onblur to trigger events when input loses focus;
3 : if it is submitted to the background, submit in the form of form form, try not to use getvalue, the security is poor;


< input type= "text" id= "spreadrateinput" onChange= "changeFunction ()" / >
< input type= "text" id= "spreaddegreeinput" onChange= "changeFunction ()" / >
changeFunction () {
var inkmax = document.getElementById ('spreadrateinput');
var times = document.getElementById (' spreaddegreeinput');
console.log (inkmax.value);
console.log (times.value);
}

how about this?

Menu