title: click event on innerHTML generated div
body: <p>I have a 'div' element generated in javascript with 'innerHTML' property.</p>
  
  <pre><code>(...).innerHTML = 'sometext'+'&lt;div id=\"a\"&gt;word&lt;/div&gt;'+obj.something+'othertext';
  </code></pre>
  
  <p>Anyway onclick event is not working.</p>
  
  <pre><code>document.getElementById('a').onclick = function() {
      //do something
  }
  </code></pre>
  
  <p>What is the problem? How do I resolve it (pure javascript, no libraries)?</p>