+2

Why doesn't this work?

It says 'Can not read property value of null'. https://code.sololearn.com/W2CGn0yTNnC7/?ref=app

10/20/2019 7:27:06 PM

Rishan [da_coder, inactive]

3 Answers

New Answer

+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

+3

Can you put it into a code?