title: Uncaught typeerror cannot read property of null (reading 'value') in javascript
body: <p>I get the error &quot;Uncaught typeerror cannot read property of null (reading 'value')&quot; I'm constantly looking for a solution and I don't know what's wrong in the code, Can you help me?</p>
  <p>My code</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function test(){
  
  for(var i=0; i &lt; 40; i++) {
  var name1.value = document.getElementsByClassName('test1')[i];
  var address1.value = document.getElementsByClassName('test2')[i];
  
  if( name1.value == "test4"){
  address1.value = "test5";
  }
  else if (name1.value == "test6"){
  address1.value = "test7";
  }
  else if (name1.value == "test8"){
  address1.value = "test9";
  }
  }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt; div class="form grup test1"&gt;
  &lt; labe for="power-full.names"&gt; Names full&lt;/lable&gt;
  &lt; input name="power-full.names" list="power-full.names" type="text"
  class="form grup test1" onclick="test"(this)"&gt;
  &lt;datalist type"text" id="power-full.names"&gt;
  &lt;option value="test4"&gt;
  &lt;option value="test6"&gt;
  &lt;option value="test8"&gt;
  &lt;/datalist&gt;
  &lt;/div&gt;
  
  
  &lt; div class="form grup test2"&gt;
  &lt; labe for="power-full.adress"&gt; Adress full&lt;/lable&gt;
  &lt; input name="power-full.adress" list="power-full.adress" type="text"
  class="form grup test2" onclick="test"(this)"&gt;
  &lt;datalist type"text" id="power-full.adress"&gt;
  &lt;option value="test5"&gt;
  &lt;option value="test7"&gt;
  &lt;option value="test9"&gt;
  &lt;/datalist&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>