this code it checks to see if the input boxes are empty, but does this return with or without it work? and this variable with true after its value is changed it continues with same value for next execution, its value should not be maintained until I send a new value?
CODE:
<input value="g" type="text" placeholder="a" class="test">
<input value="" type="text" placeholder="a" class="test">
<button onclick="win()">okkk</button>
var inputs = document.getElementsByClassName('test');
var len = inputs.length;
var valid = true;
for(var i=0; i < len; i++) {
if (!inputs[i].value) {
valid = false;
}
}
if (valid) {
console.log("ok");
return true;
} else {
console.log("no");
return false;
}