mardi 23 décembre 2014

jQuery event binding management


Given the following elements:



<div class="container">
<span class="some-class">content</span>
..n span repetitions..
</div>


Given the following .on()



$('.some-class').on('click', function () { ... });


If you redraw the .container with new span.some-class, will you leak the old events?


What I mean is, before the redraw, should you do:



$('.some-class').off('click');


Thanks!





Aucun commentaire:

Enregistrer un commentaire