title: Creating Html Element with onclick() event in javascript
body: <p>I've been working at this for the last hour, but I am still unable to get the expected output... All I want is to create an HTML element using the <code>onclick</code> event. I was able to create the element on load, but find myself unable to with the event. Please lead me in the right direction. Here's my HTML page:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
      &lt;div id="d1"&gt;
          &lt;p id="p1"&gt;Paragraph.&lt;/p&gt;
  
      &lt;/div&gt;
      &lt;div id="d2"&gt;
          &lt;label onclick="open()"&gt;Inbox&lt;/label&gt;
      &lt;/div&gt;
  
      &lt;script&gt;
          function open(){
              alert("Start");
              var para=document.createElement("p");
              var node=document.createTextNode("Text");
              para.appendChild(node);
              para.style.color="red";
              var element=document.getElementById("d2");
              element.appendChild(para);
                         }
      &lt;/script&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>