title: Passing id of html image to javascript on click
body: <p>Is there any way to pass the id/name of an html image when you click on it? It seems the onclick function is defunct now, and I can't seem to find anything with a similar functionality.</p>
  
  <p>Each image has a unique id, which is set at creation, by the name variable. This is how I am creating the clickable images</p>
  
  <pre><code>function addbutton(position, name) {
      var element = document.createElement("input");
      var imgURL = chrome.extension.getURL("icons/donate.png");
      element.setAttribute("type", "image");
      element.setAttribute("src", imgURL);
      element.setAttribute("class", "addressbuttons");
      element.setAttribute("id", name); //the name variable is set to a specific text
      element.setAttribute("onclick", "SubmissionInfo()"); //what can I replace onclick with?
      position.parentNode.insertBefore(element, position.nextSibling);
  }
  </code></pre>
  
  <p>I want this function to run with the context of which image was clicked by using the contents of the name variable, as well as the x,y coords of the images</p>
  
  <pre><code>function SubmissionInfo() {
   ...
  }
  </code></pre>
  
  <p>I know <code>SubmissionInfo()</code> should be globally accessible in its own .js file, but I don't know how to get it to detect the image being clicked and how to get the id of the image.</p>
  
  <p>Also, I've only been working with both html and javascript for a few hours now, so I apologize for any major mistakes I might have made.</p>