title: Append Text to a dynamically generated Div via jquery not working
body: <p>I am creating <code>div</code> elements on click of a <code>button</code>. The div which are generated , are <code>draggable</code> and <code>resizable</code> .</p>
  
  <p>On clicking the same dynamically generated div, a text box should appear where-in I put some text and then the same text should be appended <strong>inside</strong> that div.</p>
  
  <p>But somehow the click event on the div is not registered. Any ideas? </p>
  
  <p>jQuery:</p>
  
  <pre><code>$(".square").click(function () {
      alert("square clicked");
      $(".box").append("&lt;div class='comp1'&gt;&lt;/div&gt;");
      $(".box .comp1").resizable({
          containment: ".box"
      });
      $(".box .comp1").draggable({
          containment: ".box"
      });
  });
  
  $(".circle").click(function () {
      $(".box").append("&lt;div class='comp2'&gt;&lt;/div&gt;");
      $(".box .comp2").resizable({
          containment: ".box"
      });
      $(".box .comp2").draggable({
          containment: ".box"
      });
  });
  
  //script to append text
  $(".comp1").click(function () {
      var obj = $(this);
      alert(1);
  
      $(".btnSaveTitle").click(function () {
          alert("save title clicked");
          alert($(".componentTitle").val());
          var title1 = $(".componentTitle").val();
          obj.append(title1);
      });
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;button type="button" class="btn btn-success square"&gt;Table&lt;/button&gt;
  &lt;button type="button" class="btn btn-primary circle"&gt;Round Table&lt;/button&gt;
  &lt;button type="button" class="btn btn-primary square"&gt;Stage&lt;/button&gt;
  &lt;button type="button" class="btn btn-info pull-right btnSaveTitle"&gt;Save&lt;/button&gt;
  &lt;input type="text" class="componentTitle pull-right" placeholder="name your component" /&gt;
  &lt;br /&gt;
  &lt;div class="row"&gt;
      &lt;div class="box" style="border: double; height: 500px; position:relative ; width: 100%"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><a href="http://jsfiddle.net/oauqs8ee/" rel="nofollow"><strong>JSFiddle</strong></a></p>