title: Javascript function innerText
body: <p>I want to get the innerText of &quot;lid&quot; but when I write &quot;lid.innerText I get null values is there any other way.</p>
  <pre><code>function zoom() {
   var input = document.getElementById(&quot;myInput&quot;).value; //value from searchbox
  // console.log(input);
   d3.json(&quot;intervals.json&quot;, function(alldata)  // entering json file  to look for oid
   {
      var i;
      for (i = 0; i &lt; alldata.records.length; i++)  //for loop for getting the oid  alldata.records.length;
      {
  
        conceptid = alldata.records[i].oid;  //saving all the oid in conceptid
        lid = (&quot;l&quot; + conceptid.toString());  //concatenate with &quot;l&quot;
        console.log(lid);
  
        if (document.getElementById(lid).innerText === input)  // if lid.innertext = input
        {
  
          document.getElementById(lid).click();  //then zoom
        }
  
      }
  
   });
  }
  
  </code></pre>