title: How to add parameters onto function in setAttribute() method in javascript
body: <p>In javascript, I was creating new image tags and I was adding attributes to them with the setAttribute() method but I found that if I add an onclick event and add a function, I can't set in a parameter for it as seen below</p>
  
  <pre><code>count = 0; //Will be the number that will go into parameter for function
  function start() {
  imageTag = document.createElement("IMG"); //Creates image tag
  imageTag.setAttribute("src", "popo.jpg"); //sets the image tags source
  count++; //as the start function keeps getting called, count will increase by 1 and the parameter for each function in each individual image tag will increase by one
  imageTag.setAttribute("onclick", "disappear(count)"); //this will add the onclick attribute with the function disappear() and the parameter inside which will be a number that will increase as the start function is called again and the image tag is called again *ERROR*
  document.body.appendChild(imageTag); //appends the image tag created
  }
  </code></pre>
  
  <p>The problem is, when each new image tag is created, it literally just creates</p>
  
  <pre><code>&lt;img src = "popo.jpg" onclick = "disappear(count)"/&gt;
  </code></pre>
  
  <p>I wanted it to be more like </p>
  
  <pre><code>&lt;img src = "popo.jpg" onclick = "disappear('1')"/&gt;
  &lt;img src = "popo.jpg" onclick = "disappear('2')"/&gt; //and so on...
  </code></pre>