+ 2
Why doesn't this work?
It says 'Can not read property value of null'. https://code.sololearn.com/W2CGn0yTNnC7/?ref=app
3 ответов
+ 1
It is happening because js is loading first after that html. Change with this. It will work fine.
function removeSpaces() {
var s = document.getElementById("input");
var sv = s.value;
var l = sv.length;
var r = document.getElementById("result");
var p;
for (var i = 0; i <= l; i++) {
p = sv.replace(" ", "");
}
r.value = p;
}
+ 4
Nevermind
+ 3
Can you put it into a code?