0

I have a list of div, with the class "case".

<section class="liste">
    <div class="case">A</div>
    <div class="case">B</div>
</section>

Then, in the script, I append divs with the class "case", following the ones already there :

$(".liste").append("<div class='case'>C</div>");

I have a function, that starts when a class "case" div is clicked :

$(".case").click(function(){
    alert("it works"); }

However, this function works only for the divs already put in the HTML (A, B) but NOT for the appended div (C).

Would you know how to make my function work also for appended elements ?

Thank you.

AM.
  • 21
  • 2

0 Answers0