Element added with jquery append does not trigger event

1

I've cloned a div that contains 2 elements: checkbox and button. The elements in the main div, source, fires events normally.

It turns out that after cloning the div with the elements inside, the elements created do not fire any event. I tried it in many ways and it did not work.

Testing with part of my actual code in JSFiddle, does not work

Test with a code I created from scratch to test in JSFiddle , it works

I can not identify why it does not work in my actual code. Can you help me?

    
asked by anonymous 03.12.2014 / 22:25

1 answer

1

The problem is that the code generates a new .status element that there was not before, of which this .nova_subdemanda button is descending.

Although you are already using event delegation you have to change $('.status').on(... to $(document).on(... or:

$('#lista_status').on('click','.nova_subdemanda', function(event){

jsFiddle: link

    
03.12.2014 / 22:42