title: jQuery - Why I can't change color with append div
body: <p>Why I can't edit color with append div.</p>
  
  <p>Click button and add new div call 'block2',if using $(this), it will not work.
  How to fix it ?</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div id="btn"&gt;&lt;input name="click" type="button" value="Click" /&gt;&lt;/div&gt;
  &lt;div class="block1" style=" width:100px; height:100px; background:orange;"&gt;I am Block1&lt;/div&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>    $('#btn').click(function(){
          var $newDiv=$('&lt;div class="block2" style=" width:100px; height:100px; background:green;"&gt;I am Block2&lt;/div&gt;');
          $( "#btn").parent().append($newDiv);
  
      });
  
  $('.block1').click(function(){
      $(this).css('background', 'blue');
  });
  
  $('.block2').click(function(){
      $(this).css('background', 'blue');
  });
  </code></pre>