Loading a div and reLoading an other div + alert [Beginner]

Loading a div and reLoading an other div + alert [Beginner]

Hi, 

this is my process :

1/ I display  containing div,
2/ I click on  containing div area
3/ containing div is removed
4/ containing2 div is displayed
5/ I click on  containing2 div area
6/ I print alert " containingCL2"

The problem is between step 5 and 6 because the alert is never printed.
I guess jquery does not manage to detect the click event onto the containing div2 as this div is not native but generated.


This is my HTML code
  1. <div id="container">
  2. <div id="containing" class="containingCL">
  3. Blabla
  4. </div>
  5. </div>


This is my javascript code

  1. <script type="text/javascript">

    $('.containingCL').click(function() {


    $.ajax({

    url: 'urlPHP',

    success: function(msg) {

         // msg variable is :

         //<div id="containing2" class="containingCL2">

             // Blabla2</div>

                               $('#containing').remove();

                                 $('#container').html(msg);

             }

     });

    });


    $('.containingCL2').click(function() {

     alert(' containingCL2' );

     

    });


    </script>



    Thanks