title: Adding new div into exist div with using onClick()
body: <p>Hi im trying to add into new div into exist div by clicking that div and i should do same thing for new div. For example, I have initial div, when i click it i created different div inside it. Then i click new div and i created new div inside it. I hope explanation is understandable =) Here is my code,</p>
  
  <pre><code>&lt;script type="text/javascript" src="js/jquery-1.4.2.min.js"&gt;
  
  function run(id){
  
  var id = $(id).attr("id");
  document.getElementById(id).onclick = function () {
  var div = document.createElement('div');
     div.style.backgroundColor = "black";
     div.style.position = "absolute";
     div.style.left = "50px";
     div.style.top = "50px";
     div.style.height = "10px";
     div.style.width = "10px";
  
     document.getElementById(id).appendChild(div);
  };
  
  }
  
  
  &lt;style&gt;
  
  div.initial {
  background-color:white;
  width:400px;
  height:30px;
  }
  &lt;/style&gt;
  
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;div class='initial' onclick='run(this)'&gt;
        //new div will come here
      &lt;/div&gt; 
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The problem my javascript isnt working there is nothing when i click div with this code.</p>