0

i do have a problem witch catching an .click() event on an generated section which is created after a click of another div.

the code looks something like this.

$('#all_events_entries').append(
    '<section class=\"event_linewrapper event\"> 
       <section class=\"event_name\">test</section>
    </section>'
 ); 

After this happens, the specific sections are shown in the right way and i try to catch the click events on this section like this...

$(document).ready(function() {    
    $('.event').click(function(e) {

        e.preventDefault();
        alert("test");    

    });
});

The Problem is, this event never get executed. Is it even possible to catch a click event of an section which not exists after the first load?

Regards!

  • Learn [Event Delegation](http://learn.jquery.com/events/event-delegation/), Solution: Use `$('#all_events_entries').on('click', '.event', function(e) {........});` – Satpal Oct 25 '16 at 11:44
  • 1
    Thanks! That solves the problem :) – renekuss Oct 25 '16 at 11:51

0 Answers0