C
C
cancera2016-04-25 17:24:07
JavaScript
cancera, 2016-04-25 17:24:07

Another question about event delegation?

The bottom line is that after clone(true), clicking on the cloned button is not processed
(for the original, the event is processed in $(document).ready()).
If I understand correctly, then you need to overload this function, but how to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Ineshin, 2016-04-25
@cancera

You misunderstood, you need Event Delegation
With jQuery is very easy:

$(document).on("click", ".button", function () {
    // do something
});
// будет работать для всех клонированных кнопок

W
Wheelie, 2016-04-25
@Wheelie

$('body').on('click', 'название кнопки которая грузится динамически', function(){
    //
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question