Javascript event listener refresh

前端 未结 2 2019
栀梦
栀梦 2020-12-16 22:28

I have some javascript that I inherited for my job. In this javascript we have a side bar that is constantly updated(every 1 - 10 or so minutes). In the script we parse and

2条回答
  •  囚心锁ツ
    2020-12-16 23:13

    As @crush mentioned, use an event delegated approach to avoid unbinding and re-binding events:

    $(document).on('click', '.classElem', elm1funct);
    

提交回复
热议问题