0
                            var Z;
                            var E;
                             
              Z=document.getElementById("X").value;
              E=document.getElementById("Y").value;

I don't know why but I couldn't solve this problem If you run the codes, the following error appears in the console uncaught typeerror read properties of null (reading 'value')

  • Do you have elements with those ids in your HTML, and are you calling your script after the DOM has loaded? Are those elements `input` elements? Do they have values when the page is loaded? – Andy Oct 21 '21 at 11:38
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 21 '21 at 11:47

1 Answers1

0

I would double-check that the output of document.getElementById("X") and document.getElementById("Y") is what you expected. In case there's a mismatch in the ids (typos can happen), or for some other reason the getElementById can't lookup the DOM element, you'll get null as result.

  • How do you think the problem is solved? I double checked and even got some code from the internet to make sure there are no typos. – Malik Turan Oct 21 '21 at 11:53