Why my JS giving null value error in Web? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why my JS giving null value error in Web?

Its giving null value error when I fill the form and press submit button. https://code.sololearn.com/WFe8ejTJ7jjK/?ref=app Please run the code and help me with the error.

8th Apr 2020, 6:34 PM
Souptik Nath
Souptik Nath - avatar
2 Answers
+ 3
You use `document.write` which erases whatever already in the document. And that includes all your textboxes, and radio buttons. You can't refer to an object (e.g. using `getElementById`) that no longer exists.
8th Apr 2020, 8:35 PM
Ipang
+ 2
I too actually want to know how can one avoid that condition as Ipang explained and display all that is submitted
8th Apr 2020, 9:02 PM
Abhay
Abhay - avatar