title: how to get the textnode inside Div component onclick event
body: <p>i have created webpage using html5 + js. I have created(thro' HTML DOM) textnodes into a div component &amp; added it into webpage. on clicking a button event, i need that textnode value as alert.here is my code below.</p>
  
  <pre><code>&lt;script&gt;
  var context = document.getElementById('holder');
  for(j=0;j&lt;5;j++){
  var divs = document.createElement('div');
  var lbl= document.createElement('label');
  lbl.innerHTML = 'Hi everyone';
  divs.appendChild(lbl);
  var text = document.createTextNode('welcome to app');
  var div = document.createElement('div');
  div.appendChild(text);
  divs.appendChild(div);
  var btn = document.createElement('button');
  btn.innerHTML ='gone';
  btn.className = 'btn';
  btn.id = j;
  btn.onclick = function(){
  var a = this.parentElement.ChildNode;
  alert(a.length);
      for(i=0;i&lt;a.length;i++)
      {
       alert(a.getElementByTagName('div').TextNode);
      }
  }
  divs.appendChild(btn);
  context.appendChild(divs);
  }
  &lt;/script&gt;
  
  &lt;body&gt;
  &lt;div id='holder'&gt;&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>