title: Getting Element of a attribute tag that is linked to a function after the search is compiled in JavaScript
body: <p>I have a JavaScript file that is using a for statement to generate the links in JavaScript and a Eventlistner to listen for a click event. I need it when I click on my a specific link from my generated a link thats connected to a function in HTML, I need the link to get and pass values from the link to the string but i am unable to set the values of the innerhtml of the a tag to a variable. </p>
  
  <pre><code>    &lt;script&gt;
      or (var j = 0; j &lt; results.length; j++) {
  
              if (parseInt(results[j].distance.text) &lt;800){
  
  
              geocoder.geocode({'address': destinationList[j]},
                  showGeocodedAddressOnMap(true));
  
              outputDiv.innerHTML += '&lt;a id ="cl" href="#"&gt;' +          results[j].distance.text + ' to ' + destinationList[j] +
                  '. Destination is  ' + results[j].duration.text +' From '+ originList[i] + '&lt;/a&gt;&lt;br&gt;';
  
              }
            }
  
  
      var onChangeHandler = function() {
        display();
      }
  
  
      //EVENT LISTENER FOR LINK CLICK
      document.getElementById('output').addEventListener('click',       onChangeHandler);
  
  
      function Display(){
  
      var doc;
      doc = document.getElementbyId('cl').innerHTML;
      console.log(doc);
  
  
  
      }
  
      &lt;/script&gt;
  </code></pre>