title: how to add onclick event to create new element in javascript
body: <p>I have created a <code>label</code> element. I need to add <code>onclick</code> event to that...</p>
  
  <pre><code>function a(me) {
      var d=document.createElement("label");
      d.id=me.id;
      d.onClick="a(10)";
      d.innerHTML="welcome";
      document.body.appendChild(d);
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;label id="1" onclick="a(this)"&gt;aa&lt;/label&gt;
  &lt;label id="2" onclick="a(this)"&gt;bb&lt;/label&gt;
  &lt;label id="3" onclick="a(this)"&gt;aa&lt;/label&gt;
  </code></pre>
  
  <p>actually what happens is when i click the any of three labels in html. another label is created and displays welcome. now when i click the newly created label "welcome" it does not display anything...... that is the onclick event added to newly created label is not working ....... any suggestion.................</p>